Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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"}}


I think I have tried something similar. I will try this one too. Thanks a lot!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: