blgm / jfq

JSONata on the command line

Home Page:http://jsonata.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

jsonlines Input format

s4ke opened this issue · comments

First of all, nice and simple tool, but tt would be great if jfq would support the jsonlines format as input just as it supports it as an output format. This would make it the perfect tool for data transformation pipelines in bash.

I will be working on a pull request.

@blgm Something that I found out while working with the new feature a bit:

You can't use ndjson/jsonlines-output to convert an input array:

[
    {...},
    {...}
]

into a sequence of elements separated by newlines by passing it into jfq "$" --jsonlines-output/ndjson. Looking into the code I am not so sure as to how to achieve this behaviour properly though. The thing is that since we can never be sure what the jsonata would produce, we can not just check if the output is an array and then just go from there.

I don't think that this is solveable out of the box, however and we should advise all users to be aware of this edge case.