CSV vs JSON: Which One Should You Use?
CSV and JSON both store data, but they suit different jobs. Here is the short answer, with real numbers.
The short answer. Use CSV for flat tables that people open in a spreadsheet or load into a database. Use JSON for data with nested parts that apps and APIs exchange. If you are not sure, ask what will read the file: a person with Excel wants CSV, a program talking to an API wants JSON.
Size. We saved the same table, 100,000 rows and 7 columns, in both formats. The CSV is 6.87 MB. Compact JSON is 14.76 MB, about 2.1 times larger, because every row repeats every column name. Pretty-printed JSON is 19.56 MB. After gzip they are much closer: 1.41 MB for CSV and 1.63 MB for JSON.
Structure and types. JSON can hold nested objects and lists, and it keeps numbers, text, true and false apart. CSV is flat and has no types, so a number can turn into text and a leading zero can disappear when it is opened. CSV has no standard for delimiters or line breaks inside a cell, so files from different programs can differ.
Switching between them. Converting CSV to JSON gives one object per row. Converting JSON to CSV flattens nested fields into columns such as address.city. Both run in your browser in Data Utility, and your file is never uploaded. In our test, 100,000 rows converted to JSON in 0.34 seconds.
Related tool pages
- JSON to CSV Converter: Convert JSON to CSV online for free. Drop a file or paste data, click convert and download. It runs in your browser, so your data is never uploaded.
- CSV to JSON Converter: Convert CSV to JSON online for free. Drop a file or paste data, click convert and download. It runs in your browser, so your data is never uploaded.
- CSV to Parquet Converter: Convert CSV to Parquet online for free. Drop a file or paste data, click convert and download. It runs in your browser, so your data is never uploaded.
- JSON to Parquet Converter: Convert JSON to Parquet online for free. Drop a file or paste data, click convert and download. It runs in your browser, so your data is never uploaded.
- Parquet to CSV Converter: Convert Parquet to CSV online for free. Drop a file or paste data, click convert and download. It runs in your browser, so your data is never uploaded.
- Parquet to JSON Converter: Convert Parquet to JSON online for free. Drop a file or paste data, click convert and download. It runs in your browser, so your data is never uploaded.
How to use the Format Converter: step by step
- Open the Format Converter.
- Drop in your CSV or JSON file.
- Convert to the other format.
- Compare the file sizes.
When to use the Format Converter
- Choose a format for an export
- Explain the difference to a colleague
- Estimate the size of a JSON file
- Decide before sending data to an API
Example
Input: id,name,age 1,Ada,36 2,Alan,41
Output: [{"id":1,"name":"Ada","age":36},{"id":2,"name":"Alan","age":41}]
Frequently asked questions
How big can a file be?
It depends on your device. A few hundred MB usually works.
Which conversions does the Format Converter support?
Any direction between JSON, CSV, Parquet and Excel (.xlsx), for one file or a whole folder. Nested JSON is flattened into columns such as address.city. For Excel, the first sheet is read; old .xls files are not supported.
Why did my number or date change after converting?
Types are detected from the values. Turn off "Detect types" to keep everything as text, which also keeps leading zeros in IDs and phone numbers.
Tip: If a JSON file is not for people to read, turn off pretty-printing. It makes the file about 30 percent larger.