CLI: Json Complex Object outputting all keys as headers
See original GitHub issueI have a complex JSON object in a file that when running via the CLI outputs the keys as headers
jsonexport complex.json output.csv
complex.json
{
"complex": {
"object": 1,
"that": 2
},
"has": 3,
"nested": {
"keys": true
}
}
output.csv
complex.object,complex.that,has,nested.keys
1,2,3,true
but running it via the online demo page https://kaue.github.io/jsonexport/demo/?json={"complex":{"object":1,"that":2},"has":3,"nested":{"keys":true}}&options={}
it comes out as expected
complex.object,1
complex.that,2
has,3
nested.keys,true
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (1 by maintainers)
Top Results From Across the Web
jq - Convert JSON to table, with headers of "Key" and "Value"
This seems to work for your input data jq -r '.[] | to_entries[] | [.key,.value] | @tsv' file.json. Output (tab separated):
Read more >Reshaping JSON with jq - Programming Historian
jq's 'Compact Output' option removes all cosmetic line breaks in a file, just leaving one JSON object per line. Keeping “Compact Output” checked ......
Read more >Nested JSON - HTTPie 3.2.1 (latest) docs
If your use case involves sending complex JSON objects as part of the request body, HTTPie can help you build them right from...
Read more >Setting the AWS CLI output format
The AWS CLI supports the following output formats: json – The output is formatted as a JSON string. yaml – The output is...
Read more >json - Jq tsv - create headers from keys - Stack Overflow
I came across a way to generate headers dynamically using the key name. I am getting this error: object ({"version":...) is not valid...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Acknowledged but not expecting immediate reaction without tighter connection to what is the cause.
I have an educated guess: The options in the demo, even when blank/default I believe, are still sending those blank/default values which perhaps are being seeing as altering arguments…
If you catch my drift above, our goal would be to console log the options in the demo and then exactly send those options in your NodeJs usage.
Based on your skill level, if you cloned our gh-pages branch and console logged the options at runtime you could get our answer. The file to edit would be
gh-pages/demo/src/index.js@update:45
Good luck and may Feb 4th be with you
Yeah, we should be good here @AckerApple 😃 forgot to check the issues, still have a lot to catch up