Quantcast
Channel: Active questions tagged jq - Stack Overflow
Viewing all articles
Browse latest Browse all 657

Converting JSON to JSONL without losing original object structure

$
0
0

I have JSON that looks like:

{"18003432343": {"04:00:25": {....},"12:00:25": {....},  }, "18005553332": {"18:11:25": {....},"23:00:25": {....},  }}

If I convert the above to JSONL using:

jq -c '.[]' input.json > output.jsonl

I get the following in the output JSONL:

{"04:00:25": {....}, "12:00:25": {....}}{"18:11:25": {....}, "23:00:25": {....}}

I lose the top level keys that were in my original JSON file. I am looking for output that preserves those keys - which would look like:

{"18003432343": {"04:00:25": {....}, "12:00:25": {....}}}{"18005553332": {"18:11:25": {....}, "23:00:25": {....}}}

What is the appropriate JQ command for this?


Viewing all articles
Browse latest Browse all 657

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>