When passed, then read lines of input and parse each line as JSON.
Apply --path resolution to each parsed line.
Then handle the list of (--path-transformed) JSON-parsed lines as if they were a single JSON array.
Option 2. Accept "JSON streams"
Add -s/--stream. (Or maybe still call the flag -n/--ndjson but do this behavior?)
When passed, then read all input, and treat it as an (optionally whitespace-separated) concatenated stream of JSON values.
Apply --path resolution to each parsed JSON value.
Then handle the list of (--path-transformed) JSON-parsed values as if they were a single JSON array.
—
Thoughts? I'm open to implementing but figured I'd run it by you first.
I often finding myself converting trying to JSON to CSV and your tool is my go-to for its speed and simplicity! But it'd be nice to not have to wrap lines of JSON objects into an array before converting.
What I'd like
Example input:
Desired output:
Implementation ideas
Option 1. Only newline-delimited json
-n
/--ndjson
.--path
resolution to each parsed line.--path
-transformed) JSON-parsed lines as if they were a single JSON array.Option 2. Accept "JSON streams"
-s
/--stream
. (Or maybe still call the flag-n
/--ndjson
but do this behavior?)--path
resolution to each parsed JSON value.--path
-transformed) JSON-parsed values as if they were a single JSON array.—
Thoughts? I'm open to implementing but figured I'd run it by you first.
I often finding myself converting trying to JSON to CSV and your tool is my go-to for its speed and simplicity! But it'd be nice to not have to wrap lines of JSON objects into an array before converting.