[jq] Convert JSON to CSV with @csv

Created on November 30, 2026

You can use jq's @csv formatter to turn an array of field values into a CSV row. Save the following JSON array as dummy.json.

[
  {"name": "Tom", "age": 11},
  {"name": "Bob", "age": 22}
]
jq -r '.[] | [.name, .age] | @csv' dummy.json

.[] reads each object, [.name, .age] selects the fields in column order, and @csv formats each row. The -r option writes the CSV row as raw text, leaving the quotes that belong to the CSV format.

"Tom",11
"Bob",22
jq