-
Notifications
You must be signed in to change notification settings - Fork 30
Open
Description
What I'd like
Example input:
{"a":1,"b":2,"c":3}
{"a":4,"b":5,"c":6}
{"a":7,"b":8,"c":9}
Desired output:
a,b,c
1,2,3
4,5,6
7,8,9Implementation ideas
Option 1. Only newline-delimited json
- Add
-n/--ndjson. - When passed, then read lines of input and parse each line as JSON.
- Apply
--pathresolution 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/--ndjsonbut do this behavior?) - When passed, then read all input, and treat it as an (optionally whitespace-separated) concatenated stream of JSON values.
- Apply
--pathresolution 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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels