Takes a JSON file input and a JSONStream filter and produces a JSONL line-seperated file.
npm install json2linesjson
{
"fruits": [
{
"name": "Apple",
"color": "red"
},
{
"name": "Orange",
"color": "red"
}
]
}
`
Run it through json2lines package:
`shell
npx json2lines --input input.json --output output.jsonl --filter fruits.*
`
Will result in the following JSON Lines to the output.jsonl file:
`json
{"name":"Apple","color":"red"}
{"name":"Orange","color":"orange"}
`
Filtering
In the example above, you can see we passed the filter foods.*. This tells
us to extract the object in the foods array in the root object. For this
functionality we make use of JSONStream`. For more information on filters, you