Hey - thanks for the fantastic library and apologies in advance if this is the wrong place for this question. I was wondering if there is a preferred way of handling NDJSON (also known as JSON lines iiuc) with the library. I noticed the CLI seems to handle this fine and the same as jq. I haven't spent the time to read/trace the code yet to see what's being done there.
I was thinking of naively just putting sticking all the JSON objects a slice ([]interface{}) and passing that to query.Run/query.RunWithContext but then I'd need to effectively apply the .[] to get my desired result. Is that what's being done in the CLI or is there a bit more to it?
I recommend to run the query against each JSON object, not collecting all the objects to a slice and run once. This way works even if the input file has a lot of JSONs, and that's what the CLI does.
Hey - thanks for the fantastic library and apologies in advance if this is the wrong place for this question. I was wondering if there is a preferred way of handling NDJSON (also known as JSON lines iiuc) with the library. I noticed the CLI seems to handle this fine and the same as jq. I haven't spent the time to read/trace the code yet to see what's being done there.
I was thinking of naively just putting sticking all the JSON objects a slice (
[]interface{}
) and passing that toquery.Run
/query.RunWithContext
but then I'd need to effectively apply the.[]
to get my desired result. Is that what's being done in the CLI or is there a bit more to it?