Herramientas Guías
Developer Gratis Sin registro

JSON to CSV / CSV to JSON (Enhanced)

Convert JSON to CSV and CSV to JSON with nested object flattening and smart type detection.

Cargando la herramienta…

Acerca de esta herramienta

A two-direction converter for JSON and CSV data. JSON → CSV flattens nested objects using dot notation for keys and handles arrays of objects correctly. CSV → JSON auto-detects the header row and parses values into the right type (number, boolean, or string). Configure the delimiter (comma, semicolon, tab, pipe), quote character, and whether to include a header row. Preview the first five rows of the result before downloading the converted file.

Cómo usar

  1. 1 Paste your JSON array (or CSV text) into the input panel.
  2. 2 Select the conversion direction: JSON → CSV or CSV → JSON.
  3. 3 Choose delimiter, quote character, and header row options.
  4. 4 Click 'Convert' to see a preview of the first 5 rows.
  5. 5 Click 'Download' to save the full converted file.

Bridging two formats that don't speak the same language

JSON and CSV solve different problems. JSON stores structured, nested data the way programs think about it — objects inside objects, arrays of values. CSV stores flat, tabular data the way spreadsheets and databases expect it — rows and columns, nothing nested. Moving between them is one of the most common chores in data work, and the friction comes from that structural mismatch. This converter handles the translation in both directions, entirely in your browser, with no upload to a server.

How JSON becomes CSV

The converter expects an array of objects, because each object becomes one row. The hard part is nesting, which CSV has no concept of, so the tool flattens every object first. A nested key like {"address": {"city": "Paris"}} is collapsed into a single column named address.city using dot notation. Arrays of simple values are joined with semicolons (so ["red","blue"] becomes red;blue in one cell), while arrays that contain objects are preserved as a JSON string inside the cell. The tool then scans every row to build the complete set of column headers, so even if some objects are missing a field, the column still appears and those cells are left blank.

Values that would break the CSV structure are escaped automatically. If a value contains your delimiter, a quote character, or a line break, the whole value is wrapped in quotes and any internal quotes are doubled — exactly as the CSV convention (RFC 4180) requires. You can change the delimiter (comma, semicolon, tab, or pipe), switch the quote character, and toggle whether a header row is written.

How CSV becomes JSON

Going the other way, the first row is treated as the header, and each subsequent row becomes one object keyed by those headers. The parser is quote-aware: it correctly handles fields wrapped in quotes that themselves contain commas or escaped quotes, so a cell like "Smith, John" stays intact instead of splitting into two columns. It also performs automatic type inference — the string 30 becomes the number 30, true and false become booleans, and empty cells become null. The result is pretty-printed JSON with two-space indentation, ready to paste into code.

A worked example

Paste this into the JSON side:

[{"name":"Alice","age":30,"city":"Paris","tags":["vip","beta"]},{"name":"Bob","age":25,"city":"London"}]

With a comma delimiter and headers on, you get:

name,age,city,tags
Alice,30,Paris,vip;beta
Bob,25,London,

Notice three things: the tags array collapsed to a semicolon-joined cell, Bob has no tags so his last cell is empty, and the column order follows first appearance. Run the reverse direction on that CSV and the numbers come back as real numbers and the empty tags field as an empty string, demonstrating the round trip.

Practical use cases

  • Loading API data into a spreadsheet. Most APIs return JSON; converting to CSV lets you open the results in Excel, Google Sheets, or Numbers for sorting and charting.
  • Importing into a database. Bulk-import tools and SQL COPY commands typically want CSV, not JSON.
  • Handing data to non-developers. A CSV is universally readable; a JSON blob is not.
  • Seeding a config or test fixture. Convert a quick spreadsheet of test cases into a clean JSON array for your codebase.

Tips and common mistakes

  • Wrap your data in an array. A single bare object {...} won't convert — the tool needs [{...}] because each object maps to a row. This is the most frequent error.
  • Pick the right delimiter for your locale. Many European spreadsheets expect a semicolon because the comma is a decimal separator. If your CSV opens as one mangled column, switch the delimiter to semicolon and reconvert.
  • Choose tab delimiter for messy text. If your values are full of commas, exporting as TSV (tab-separated) avoids a forest of quotes.
  • Watch type inference on IDs. A ZIP code like 01234 or a long numeric ID may be read as a number on the CSV-to-JSON pass, dropping a leading zero. If exact string fidelity matters, keep such fields explicitly quoted and be aware of the conversion.
  • Deeply nested objects flatten, they don't disappear. Expect dotted column names like user.address.zip; that's by design, not a bug.

A note on privacy

All parsing, flattening, and escaping run locally in your browser. Your data is never transmitted, which makes this safe for confidential exports — you can disconnect from the network and the converter still works.

Preguntas frecuentes

{# Alpine.js — self-hosted. (The previous jsdelivr CDN tag had a stale SRI integrity hash, so the browser refused to run it and window.Alpine was never defined — silently breaking every FAQ accordion and Alpine tool.) #}