Skip to content
brownie.tools

CSV to JSON Converter

Map columns, preserve identifiers and choose types before downloading JSON or NDJSON.

CSV Input
Advanced options

Runs locally in your browser. Nothing is uploaded or sent to a server.

Paste CSV into CSV Data or choose Open file to get a JSON array that updates automatically. Use Columns and preview to rename, exclude or reorder fields and set each column's type. Values start as strings; Auto preserves leading-zero identifiers, while Number explicitly converts numeric text. Choose a decimal separator, enable Nest dotted headers for objects and arrays, or download NDJSON with one object per line. File reading and conversion run locally in your browser.

Updated

How do you convert CSV into a JSON array?

Paste a header row and data into CSV Data, or choose Open file. JSON Output updates automatically; there is no separate conversion button. With the default settings, each data row becomes an object, headers become property names and every cell stays a string. This example uses a quoted comma, an identifier with leading zeros and a decimal amount:

id,name,price,active
007,"Ada, Jr.",12.5,true

Leave the defaults unchanged to get:

[
  {
    "id": "007",
    "name": "Ada, Jr.",
    "price": "12.5",
    "active": "true"
  }
]

In Columns and preview, keep id and name as String, change price to Number and active to Boolean. The same record now has "price": 12.5 and "active": true, while "id": "007" survives unchanged. This makes mixed data practical: identifiers need not follow the same conversion rule as quantities. Choose Download .json to save the array as output.json.

How can you map columns before downloading?

Columns and preview lets you change Output name without editing the source header, exclude fields with inclusion checkboxes and reorder fields using Move up or Move down. The source preview shows the first 20 data rows in your selected column order. It shows source values, so check JSON Output to see the effects of type conversion and nesting.

Output names must be nonempty and included columns must not conflict. Two columns named email require a rename or exclusion; a blank header needs an Output name. At least one column must remain included. Unsafe names such as __proto__, constructor and prototype are rejected by the mapping validation.

Finish editing the source and basic parsing settings before mapping. Changing CSV Data clears column customizations. Changing Delimiter, First row is header or Trim whitespace also resets mappings because those settings can change the source column definitions.

Which types should you choose for each column?

Detect types is off initially, so columns start as String. Enabling it gives columns without an explicit type choice Auto conversion. A type selected directly for a column remains explicit when Detect types changes. Use the following distinctions when preparing data for an API or database:

Column type behavior
TypeConversion rule
StringKeeps text, including leading zeros.
AutoConverts lowercase true, false and null, and decimal numbers whose normalized text round-trips unchanged.
NumberAccepts signed decimal and exponent notation; rejects invalid or nonfinite results.
BooleanAccepts only lowercase true or false; other values produce an error.
Null-if-emptyConverts an empty string to null and keeps other cells as text.
Date (ISO)Accepts an ISO date or a timestamp with a timezone and returns a UTC ISO timestamp.

Auto does not infer dates. Date (ISO) converts a date-only value to midnight UTC with the suffix T00:00:00.000Z; a timestamp must include seconds and a timezone. Ambiguous slash-separated dates are rejected. Explicit Number uses JavaScript numbers, so do not use it to preserve arbitrary-precision identifiers. String is the appropriate choice when every digit matters.

How do delimiters and decimal separators interact?

Auto-detect counts comma, semicolon, tab and pipe separators outside quotes in the first nonempty line. It selects the highest count, with candidate priority comma, semicolon, tab, then pipe for ties. With no separator detected, it uses comma. A misleading first line can therefore require a manual Delimiter choice.

The decimal setting is independent. For semicolon-separated data with decimal commas, choose Semicolon (;) and Decimal separator: Comma (,). Select Number or Auto on the relevant columns. If comma itself separates columns, quote cells containing decimal commas so the parser treats each as one field. The numeric converter handles a decimal separator, not thousands-grouping symbols or currency signs.

How are quotes, whitespace and empty cells handled?

The parser implements RFC 4180 quoting conventions: double-quoted fields can contain delimiters and line breaks, and two double quotes inside a quoted field represent one literal quote. An unclosed quoted field reports its starting line. CRLF, LF and CR line endings are accepted, a leading byte order mark is removed and empty unquoted lines are skipped.

Spaces are preserved unless Trim whitespace is enabled; that option trims both headers and cell values. Empty cell as null applies before the selected column type, including String. Without it, an empty numeric or Boolean cell causes a type error, while Null-if-empty handles that case as null. A quoted empty field is retained as a record rather than discarded as a blank line.

How do dotted headers become nested JSON?

Enable Nest dotted headers to interpret property paths and bracketed array indices:

user.name,user.age,tags[0],tags[1]
Ada,36,math,code

With default String types, this produces:

[
  {
    "user": { "name": "Ada", "age": "36" },
    "tags": ["math", "code"]
  }
]

With nesting disabled, the same headers remain literal keys. Invalid paths and indices above 9999 also remain flat. Nesting does not group separate rows into one parent object. Paths such as user and user.name conflict in the column mapper; rename or exclude one before proceeding. Use JSON Formatter to inspect the resulting structure.

What happens when row lengths differ or headers are missing?

By default, a row with a different cell count stops conversion with a message identifying the row and expected width. Allow ragged rows uses the header width: missing cells become null, excess cells are dropped and a warning reports the number of adjusted rows. Excluding a column does not bypass the source row-width check.

Switch off First row is header when the first record contains data. Keys become col1, col2 and so on, and the first record is included. In this mode, strict parsing uses the first row's width; ragged mode uses the widest record. With headers enabled, a header alone is insufficient: at least one data row is required.

Should you download JSON or NDJSON for a large file?

JSON array creates one document, formatted with two-space indentation. NDJSON (one object per line) creates compact records separated by newlines, without an outer array, and downloads as output.ndjson. Choose the format expected by your receiving application. For an ordinary JSON document, JSON Validator provides a separate syntax check.

Open file accepts CSV, TSV and text files; it reads their text locally. Conversion also runs in the browser. No fixed file-size cap is configured here, but the source, parsed records and serialized output are held in memory. NDJSON changes the output format without providing streaming conversion. Start with a smaller export if the page becomes unresponsive, and verify the displayed row count before importing the download.

How to Use CSV to JSON Converter

  1. CSV Data

    Paste CSV into CSV Data, drop a local file onto the editor or choose Open file. Sample loads a three-record example.

  2. Advanced options

    Set Delimiter and Output format. Keep First row is header checked for named fields; enable Detect types, Empty cell as null, Trim whitespace, Nest dotted headers or Allow ragged rows as needed.

  3. Columns and preview

    Edit Output name, uncheck unwanted columns, use Move up or Move down and select Type. Set Decimal separator to match numeric cells. The source preview shows the first 20 rows.

  4. JSON Output

    Review JSON Output, or NDJSON Output when selected. Resolve any Parse Error, then use Download .json or Download .ndjson to save output.json or output.ndjson.

Frequently Asked Questions