Skip to main content

json

The json command converts CSV data to JSON format.

Syntax

qsv json [options] <input_file> [<output_file>]

Description

The json command is used to convert CSV data to JSON format. This is useful for integrating with systems that require JSON input.

Options

  • --no-headers: When set, the first row will not be interpreted as headers
  • --pretty: Output pretty-printed JSON

Examples

Convert to JSON

Convert a CSV file to JSON format:

qsv json DLD_Transactions_English_500.csv output.json

Pretty-Printed JSON

Output pretty-printed JSON:

qsv json --pretty DLD_Transactions_English_500.csv output.json

Common Use Cases

  • Integrating with systems that require JSON input
  • Preparing data for web development

Tips

  • Verify the output to ensure the JSON is correctly formatted
  • Use in combination with other commands for complex data processing

See Also

  • select - for selecting specific columns
  • apply - for data transformations