4 ms·
I would think something like this would work: cat input.json | jq -c --stream '. as $in | select(length == 2 and $in[0][0] == "users") | {}|setpath($in[0][1:
by mbell 9y ago
I would think something like this would work:
cat input.json | jq -c --stream '. as $in | select(length == 2 and $in[0][0] == "users") | {}|setpath($in[0][1:]; $in[1])' > users.jsonlines
Output would me a file that looks like this:
{"userid1":{"name":"user1"}}
{"userid2":{"name":"user2"}}
- asadlionpk 9y agoI think I have tried something similar. I will try this one too. Thanks a lot!