SEOLyzerPro

100% Free forever - No account required

Use 47 free online tools: meta tag and robots.txt generators, image and text tools, JSON converters, calculators and unit converters. No signup needed

JSON to CSV Converter

Turn JSON data into CSV for spreadsheets

JSON to CSV Converter

What this tool does

The JSON to CSV Converter turns data written in JSON into a CSV table that you can open in Excel, Google Sheets or LibreOffice. Paste a JSON list of records, click Convert, and the tool produces rows and columns, with the keys used as column headings. It is useful when an API, a database export or a web service gives you JSON, and you want to filter, sort, chart or share the data as a spreadsheet.

How to use it

  1. Paste your JSON into the input box. The most reliable shape is a list of objects.
  2. Click Convert.
  3. Check the table or the CSV text that appears.
  4. Copy the result, or download it as a .csv file, and open it in your spreadsheet program.
  5. Use Reset to clear the box and start again.

A worked example

JSON input:

 
json
[
  {"name": "Ali", "age": 30, "city": "Lahore"},
  {"name": "Sara", "age": 25, "city": "Karachi"}
]

CSV output:

 
name,age,city
Ali,30,Lahore
Sara,25,Karachi

The keys became the header row, and each object became one row. The file has three lines: one header and two records.

How the conversion works

CSV stands for comma-separated values. It is a plain text format where each line is a row, and the values in a row are separated by commas. JSON is more flexible, because it can hold lists inside lists and objects inside objects. A CSV is flat, so the converter has to decide how to turn a structured record into a single row.

For a flat list of objects, this is simple. The tool collects the keys from the records, writes them as the first line, and then writes the values of each record in the same order. If one record has a key that others lack, a good converter adds that key as a new column and leaves the cell empty for records without it. In the example above, if Sara had an extra key “email”, there would be a fourth column, and Ali’s email cell would be blank.

Commas, quotation marks and line breaks inside values

A value can itself contain a comma, a quotation mark or a line break. The usual CSV rules (described in RFC 4180) handle this with double quotes:

  • A value that contains a comma, a double quote or a line break is wrapped in double quotes: "Smith, John".
  • A double quote inside a value is written twice. The text 5" screen becomes "5"" screen".
  • A line break inside a quoted value stays as part of that value, and the spreadsheet shows it as a multi-line cell.

For example, this record:

 
json
{"name": "Smith, John", "note": "He said \"hello\""}

becomes:

 
name,note
"Smith, John","He said ""hello"""

If you build a CSV by hand and forget these rules, a comma in the data will push values into the wrong columns.

Nested objects and arrays

Real JSON often contains nested data, such as this:

 
json
{"name": "Ali", "address": {"city": "Lahore", "zip": "54000"}, "tags": ["a", "b"]}

A CSV cell cannot hold a structure, so converters use one of two approaches. Some flatten the nested object into columns with names joined by a dot, so you get address.city and address.zip. Others write the nested part into a single cell as text. Arrays are usually joined into one cell, for example “a;b”, or written as JSON text.  If your data is deeply nested, it is often easier to decide first which fields you want, and then prepare a simple list before you convert.

Data types are not kept

JSON knows the difference between the number 30, the text “30”, true, false and null. CSV stores everything as text, and the spreadsheet program guesses the type when you open the file. This can cause surprises:

  • The text “00123”, such as a postal code or an ID, may lose its leading zeros and show as 123.
  • A long number, such as a 16-digit card or order number, may be shown in scientific notation like 1.23457E+15, and the last digits may be lost.
  • Text that looks like a date, such as 3/4, may be converted into a date.
  • null usually becomes an empty cell, and true and false become the words TRUE and FALSE.

To keep leading zeros, import the file as text in your spreadsheet program (use the data import option and mark the column as text), instead of double-clicking the file.

Opening the file in Excel

Excel in some regions expects a semicolon, not a comma, between values, because the comma is used as the decimal mark in numbers such as 3,14. If your file opens as one long column, try the import wizard and choose the delimiter. Characters from other languages, such as Urdu, Arabic or accented letters, can appear as strange symbols unless the file is saved as UTF-8, and some versions of Excel work better when a byte order mark (BOM) is added at the start of the file. Google Sheets and LibreOffice usually handle UTF-8 without extra steps.

A safety note about spreadsheet formulas

If a cell value begins with =, +, - or @, a spreadsheet may treat it as a formula. Data that came from an untrusted source could use this to run unwanted formulas when someone opens the file, a risk known as CSV injection. If you convert data from users or from the web, review it before you open the result in a spreadsheet, and consider adding a leading apostrophe or a space to such values.

Tips for good results

  • Make sure your JSON is valid first. If the tool reports an error, check it with the JSON Formatter.
  • Use a list of records that all have the same keys. It gives the cleanest table.
  • Decide beforehand how to treat nested data, and flatten it if necessary.
  • Check the first few rows against the original data before you rely on the whole file.
  • Keep the JSON file. CSV loses types and structure, so you cannot rebuild the original perfectly.
  • For very large data sets, use a script or a database tool on your own computer.

Privacy

“The conversion happens in your browser and your data is not sent to our server.” Data files often contain customer names, email addresses or other private information. Remove or replace sensitive values before you paste them into any online tool.

Limits of this tool

The converter changes the structure of the data. It does not check whether your data is correct, remove duplicates or clean values. Deeply nested JSON may not convert in the way you expect. Very large inputs may be slow in older browsers.

Frequently asked questions

What JSON shape works best?
A list of objects with the same keys, such as [{"a":1},{"a":2}].

Why do my leading zeros disappear?
The spreadsheet treats the value as a number. Import the column as text.

What happens to nested data?
It is flattened into dotted column names or written into one cell, depending on the tool.

Why does my file open as one column?
Your spreadsheet may expect a different delimiter, such as a semicolon.

Can I convert the CSV back to JSON?
Yes, with the CSV to JSON Converter, although the original data types are not restored exactly.

Related tools

CSV to JSON Converter, JSON Formatter, Text Compare, Remove Line Breaks, Base64 Encode and URL Encode.