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.
Live preview
Exactly what your visitors will seeUnder the widget on your page: Powered by A2Z Tools
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.
<div data-a2z-widget="json-csv-converter" data-height="710"></div> <script async src="https://a2z.tools/embed.js"></script>
Adds a small script (what it does) that sizes the widget to fit its content, loads it lazily and keeps it isolated from your page's CSS.
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
- RFC 4180: Common Format and MIME Type for Comma-Separated Values (CSV) Files - IETF . Quoting, doubled quotes and CRLF line endings
- 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
<a href="https://a2z.tools/json-to-csv">A2Z Tools JSON to CSV Converter</a>
[A2Z Tools JSON to CSV Converter](https://a2z.tools/json-to-csv)
JSON to CSV Converter by A2Z Tools - https://a2z.tools/json-to-csv
Related widgets
-
Pretty-print, minify or validate JSON, with the line and column of the first syntax error.
-
Compare two versions of a text line by line or word by word, with additions and removals marked.
-
Encode text to Base64 or decode it, with proper UTF-8 and an optional URL-safe alphabet.
-
Percent-encode or decode text and URLs, and find the exact position of a malformed escape.
-
Read a JSON Web Token's header and claims, with exp, nbf and iat shown as dates.
-
Generate 1 to 100 random v4 or time-ordered v7 UUIDs in several formats.