FGRibreau / jq.node

jq.node - like jq but WAY MORE powerful (300+ helpers 🔥 & 1.45M modules 😱)
https://twitter.com/FGRibreau
Other
465 stars 28 forks source link

Implement JSON input stream support #6

Open FGRibreau opened 7 years ago

FGRibreau commented 7 years ago

jq.node should support JSON lines and/or simply a stream of \n separated records.

Support this:

$ echo -e '{"foo": "bar"}\n{"baz": "qux"}' | jq '.'
{
  "foo": "bar"
}
{
  "baz": "qux"
}
dosentmatter commented 4 years ago

A JS only workaround right now is to use https://www.npmjs.com/package/jsonlines2json

echo -e '{"foo": "bar"}\n{"baz": "qux"}' | jsonlines2json | jqn

There are a couple other jsonlines parsers I found on npm, but jsonlines2json is the only one I found with a CLI.

Perhaps initial support could be jq's --slurp option. We could just use the node API of jsonlines2json. Or we can look for another package