Skip to content
PithLab

↑↓ to move · Enter to open · Esc to close

CSV to JSON Converter

Turn CSV or TSV into a JSON array of objects.

Use via API

Convert CSV (comma, semicolon, tab or pipe separated) to JSON. Send JSON, get JSON back.

POST https://pithlab.com/api/v1/tools/csv-to-json

curl https://pithlab.com/api/v1/tools/csv-to-json \
  -H "Authorization: Bearer $PITHLAB_KEY" \
  -H "Content-Type: application/json" \
  -d '{"input":"name,age\nAda,36\nAlan,41","inferTypes":true}'

Fields and responseOpenAPI documentGet an API key

About the CSV to JSON Converter

Convert CSV to JSON in your browser. Handles quoted fields, embedded commas and line breaks, detects comma, semicolon or tab delimiters, and can infer number types.

How to use the CSV to JSON Converter

  1. Paste CSV into the input box, or press Example.
  2. Leave the delimiter on Auto-detect, or choose comma, semicolon, tab or pipe.
  3. Keep “First row is a header” ticked to get objects keyed by column name, or untick it to get arrays.
  4. Tick “Convert numbers and booleans” if you want 42 and true rather than "42" and "true".
  5. Copy the JSON or download it as a .json file.

Examples

CSV with a quoted comma

Input

id,name,city
1,Ada Lovelace,London
2,"Hopper, Grace",New York

Output

[
  {
    "id": "1",
    "name": "Ada Lovelace",
    "city": "London"
  },
  {
    "id": "2",
    "name": "Hopper, Grace",
    "city": "New York"
  }
]
Semicolon-separated (European Excel)

Input

product;price
Tea;2,50

Output

[
  {
    "product": "Tea",
    "price": "2,50"
  }
]

Frequently asked questions

How are quotes and commas inside values handled?

As RFC 4180 describes: a field wrapped in double quotes may contain the delimiter and line breaks, and a literal quote inside it is written as two quotes (""). The quotes themselves are removed from the output.

Why are my numbers strings?

CSV has no types, so every value is text by default. Turn on number and boolean conversion to change that. Values such as 007, or integers too long to store exactly in JSON, stay as strings so nothing is silently altered.

My file from Excel uses semicolons. Will it work?

Yes. Excel in many European locales saves CSV with semicolons because the comma is the decimal separator. Auto-detect recognises semicolon, comma, tab and pipe delimiters.

What happens with rows that have too many or too few fields?

Missing fields become empty strings and extra fields get column_N keys. A warning tells you how many rows were uneven so you can check the source.