RecordStream icon indicating copy to clipboard operation
RecordStream copied to clipboard

Feature request: recs decollate

Open tzenes opened this issue 5 years ago • 2 comments

Right now when I use recs decollate it dumps the original object into my new records

% echo '{"field":[{"test":5},{"test":6}]}' | recs decollate -d unarray,field,temp
{"temp":{"test":5},"field":[{"test":5},{"test":6}]}
{"temp":{"test":6},"field":[{"test":5},{"test":6}]}

I can clean this up on my own:

% echo '{"field":[{"test":5},{"test":6}]}' | recs decollate -d unarray,field,temp | recs xform '$r={{temp}}'
{"test":5}
{"test":6}

But it'd be nice to not have to (since there is presumably wasted work)

tzenes avatar Mar 21 '19 22:03 tzenes

Mentioned on irc, one way to do this is like so:

% echo '{"field":[{"test":5},{"test":6}]}' | recs xform '$r = {{field}}'
{"test":5}
{"test":6}

Though I agree that it would be nice for decollate to have an option to not include the original values

benbernard avatar Mar 21 '19 22:03 benbernard

I hadn't realized xform was clever like that, thank you!

tzenes avatar Mar 21 '19 22:03 tzenes