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

How to use jq to output JSONL (one independent JSON object per line)

$
0
0

My request sounds trivial but I could not find a way to do it. I have as input an array of JSON objects:

[    {"foo": 1,"bar": 2    },    {"foo": 3,"bar": 4    },    (...)]

and I want as output the JSONL version of the same, aka one object per line, not an array:

    { "foo": 1, "bar": 2 }    { "foo": 3, "bar": 4 }    (...)

This is not the same as using --compact-output, as that would preserve the array and give me:

    [ { "foo": 1, "bar": 2 }, { "foo": 3, "bar": 4 }, (...) ]

Thank you in advance.


Viewing all articles
Browse latest Browse all 657

Trending Articles



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