Open porg opened 3 months ago
On my second read of the manpage I realized that --keys is probably getting close to what I need. But still I cannot achieve my desired goal. I'm doing something wrong it seems:
$ json2csv example.json --keys people
people
"[{""firstname"":""Jon"",""lastname"":""Doe"",""birthday"":""1978-02-19"",""gender"":""m""},{""firstname"":""Jane"",""lastname"":""Doe"",""birthday"":""1982-04-21"",""gender"":""f""},{""firstname"":""Dave"",""lastname"":""Meyer"",""birthday"":""1964-12-03"",""gender"":""m""}]"
$ json2csv example.json --keys people --unwind-arrays
people
"{""firstname"":""Jon"",""lastname"":""Doe"",""birthday"":""1978-02-19"",""gender"":""m""}"
"{""firstname"":""Jane"",""lastname"":""Doe"",""birthday"":""1982-04-21"",""gender"":""f""}"
"{""firstname"":""Dave"",""lastname"":""Meyer"",""birthday"":""1964-12-03"",""gender"":""m""}"
So yes, I'm out of wits. Looking forward to your reaction!
@mrodrig any input? Would be appreciated! Thanks!
Foreword
User Story
From a large JSON file containing a lot of stuff I want the option to select only a particular object for export to CSV.
With a syntax like
--select "path.to.object"
Or another argument name you deem appropriate as the mnemonics
-s
and-S
are both already taken.Given example.json
To get
people.csv
I'd run…which results in:
To get
locations-asia.csv
I'd runwhich results in: