0

I'd like to convert below file into a csv file, I think jq would be the suitable tool for it.

[
  [
    "123456789012",
    "071395e8xxxxxxxx",
    bad,
    failed
  ],
  [
    "098765432123",
    "094e9c34d3xxxxxxxx",
    good,
    successful
  ],
  ...
]

to

123456789012,071395e8xxxxxxxx, bad, failed
098765432123,094e9c34d3xxxxxxxx,good,successful

1 Answer 1

1

Unfortunately, the input as shown is not quite valid JSON, so you would have to tweak it somehow before presenting it to JSON. The jq command for converting to CSV would then be along the lines of:

jq -r '.[] | @csv' input.json
Sign up to request clarification or add additional context in comments.

1 Comment

you are the super hero, mate.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.