dflemstr / rq

Record Query - A tool for doing record analysis and transformation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Not able to select fields

james64 opened this issue · comments

I am "reporting" this only as feedback of why I am not trying to use rq after initial try. I am unable to do this trivial "select" transformation:

{ "a" : 1, "b" : 2, "c" : 3} -> ... -> { "a" : 1, "c" : 3}

Either it is not supported or it is very weirdly named and I cannot find it. I tend to think it is the latter because this is so basic operation that it is hard to imagine it missing.

I think you're probably looking for map which is used like so:

$ echo '{"a" : 1, "b" : 2, "c" : 3}' | rq 'map(({a, c}) => ({a, c}))'
{
  "a": 1,
  "c": 3
}

I have since removed Javascript support from rq, it might be added back some time in the future!