P
Privatool
Tutorial3 min read

JSON to CSV Converter — Convert Between JSON and CSV Online Free

Learn when to use JSON vs CSV, how to convert between formats, and how to handle nested JSON objects in CSV conversion. Free online converter included.

By Privatool Team·

JSON and CSV are the two most common formats for structured data. Understanding when to use each — and how to convert between them — is an essential skill for anyone working with data, APIs, or spreadsheets.

JSON vs CSV — when to use each

Use JSON when:

  • Data has nested structures (objects within objects, arrays within objects)
  • Data types matter and must be preserved (numbers vs strings, booleans, null)
  • Working with APIs or web applications
  • Different records may have different fields (sparse data)
  • The data will be read by a developer or consumed by code

Use CSV when:

  • Data is flat and tabular (every row has the same columns)
  • Opening in Excel or Google Sheets
  • Importing into a relational database
  • Sending data to non-technical users
  • File size matters — CSV is more compact than JSON for flat tabular data

JSON structure types and CSV compatibility

Simple array of objects — ideal for CSV

[
  {"name": "Alice", "age": 30, "city": "Hanoi"},
  {"name": "Bob",   "age": 25, "city": "HCMC"}
]

Converts cleanly to:

name,age,city
Alice,30,Hanoi
Bob,25,HCMC

Nested objects — requires flattening

[
  {
    "user": {
      "name": "Alice",
      "address": {"city": "Hanoi", "country": "VN"}
    }
  }
]

With dot-notation flattening becomes:

user.name,user.address.city,user.address.country
Alice,Hanoi,VN

Arrays within objects — complex

[{"name": "Alice", "tags": ["developer", "designer"]}]

Arrays inside objects have no clean CSV representation. Options include joining with a delimiter (developer;designer), expanding to multiple rows, or taking only the first value. Choose the strategy that best fits your downstream use.

Common CSV issues to watch for

Delimiter conflicts: If cell content contains commas, the cell must be wrapped in double quotes: "Ho Chi Minh, City". A proper CSV parser handles this. A naive split(',') approach breaks.

Encoding: Always save CSV files as UTF-8 for maximum compatibility, especially when the data contains non-ASCII characters (Vietnamese, Chinese, accented European characters, emoji).

Line endings: Windows uses CRLF (\r\n), Unix/Mac uses LF (\n). Some tools are sensitive to this — Python's csv module, for example, needs newline='' when opening files on Windows.

Numeric formatting: 1,234.56 (US format) vs 1.234,56 (European format) — be careful when opening CSV files in a regionally configured Excel, which may misinterpret numbers.

Quoted fields in CSV → JSON: When converting CSV to JSON, quoted fields that contain commas, quotes, or newlines must be parsed correctly. The JSON output should preserve these as proper string values.

Type inference in CSV to JSON conversion

A raw CSV file has no type information — every value is a string. When converting to JSON, type inference can restore the original types:

CSV value With inference Without inference
42 42 (number) "42" (string)
3.14 3.14 (number) "3.14" (string)
true true (boolean) "true" (string)
null null (null) "null" (string)
"hello" "hello" (string) "hello" (string)

Disable type inference when all values must remain strings regardless of content.

How to convert JSON to CSV free

  1. Go to JSON ↔ CSV Converter
  2. Select direction: JSON → CSV or CSV → JSON
  3. Paste your data or upload a .json or .csv file
  4. Enable "Flatten nested objects" for nested JSON structures
  5. Choose your delimiter (comma, semicolon, or tab)
  6. Preview the table output, then copy or download the result

All conversion runs in your browser — no data is uploaded to a server.

#json to csv#csv to json#data conversion#json format#csv format

Related Posts

Try our free tools

All tools run in your browser. Files never leave your device.

Explore free tools →