question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CLI: Json Complex Object outputting all keys as headers

See original GitHub issue

I 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:open
  • Created 3 years ago
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
AckerApplecommented, Feb 4, 2021

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

0reactions
kauecommented, Sep 29, 2021

Yeah, we should be good here @AckerApple 😃 forgot to check the issues, still have a lot to catch up

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found