JSON to CSV Converter Widget

Give readers a two-way JSON and CSV converter. An array of objects becomes a spreadsheet-ready CSV with nested fields flattened, and a CSV file with a header row becomes a JSON array.

Developer Tools Converter Runs in your browser Free · no ads

Customize your widget

Theme
Auto follows the visitor's light/dark setting.
Style
Attribution on your page
Optional and entirely your choice. The exact line is shown in the code below; it links to the tool with rel="nofollow".
More options
Starting values
Leave blank to use the widget's defaults. Visitors can still change every value.

Live preview

Exactly what your visitors will see

Embed code

<iframe src="https://a2z.tools/embed/w/json-csv-converter" title="JSON to CSV Converter by A2Z Tools" width="100%" height="710" style="border:0;width:100%" loading="lazy" allow="clipboard-write"></iframe>

A plain iframe. Works everywhere, including site builders that strip scripts. Adjust height if your content needs more room.

Works with

How it works

JSON to CSV takes the union of every key across all records, in the order the keys first appear, so a field present in only some records still gets a column. Nested objects are flattened into dot-separated column names (address.city) and arrays are written as JSON text in a single cell. Each field is quoted according to RFC 4180 when it contains the delimiter, a double quote, a line break or leading/trailing spaces, and embedded quotes are doubled. CSV to JSON uses a proper RFC 4180 parser, so quoted fields can contain commas, doubled quotes and line breaks; duplicate or blank headers are renamed rather than silently overwritten, and numbers are converted only when that loses nothing (007 and 1.50 stay text).

Method

  • Header = union of keys in first-seen order; missing values are empty cells
  • Nested object {"a":{"b":1}} -> column a.b; arrays -> JSON text in one cell
  • Quote a field if it contains the delimiter, ", CR or LF, or starts/ends with a space; " becomes ""
  • Rows end with CRLF (RFC 4180); delimiter: comma, semicolon, tab or pipe
  • CSV -> JSON: first row is the header; a value becomes a number only if String(Number(v)) === v

Limitations

  • JSON null and a missing key both become an empty cell, so the difference is lost in the CSV.
  • Keeping long integers exact needs a browser that gives JSON.parse revivers the source text (recent Chrome, Edge, Firefox, Safari); older browsers round integers beyond 2^53.
  • Only an array of objects converts to rows; a top-level object, or arrays nested more than 64 levels, are refused.
  • CSV to JSON always treats the first row as the header and never guesses booleans or dates: true, false and 2026-01-31 stay strings.

Where publishers use it

  • API tutorials that show how to export a response into Excel or Google Sheets
  • No-code and data-journalism blogs converting open-data CSV files for use in JavaScript
  • Shopify, WooCommerce or CRM help centres explaining product or contact import files
  • Teaching pages that contrast tabular and hierarchical data formats

Questions

How are nested objects handled?

They are flattened into dot-notation columns, so an address object holding a city field ("address": { "city": "Pune" }) gives a column named address.city. Switch flattening off to keep the whole object as JSON text in one cell.

Which delimiter should I use for Excel?

Comma works in most locales. Where the decimal separator is a comma (much of Europe), Excel expects a semicolon, so pick semicolon for those readers.

Will large IDs lose digits?

Not in current browsers: long integers are written exactly as they appear in the JSON. When converting CSV to JSON, numbers too long to be exact stay as strings.

Is there a size limit?

Up to 1,000,000 characters and 100,000 rows, all processed in the browser.

Sources

  1. RFC 4180: Common Format and MIME Type for Comma-Separated Values (CSV) Files - IETF . Quoting, doubled quotes and CRLF line endings
  2. RFC 8259: The JSON Data Interchange Format - IETF . Input and output JSON syntax

Cite or recommend this tool

If you reference this tool in an article, course or documentation, these formats are ready to copy. They are optional - nothing is added to your site unless you paste it.

A2Z Tools JSON to CSV Converter
https://a2z.tools/json-to-csv

Preview