Convert to JSON

Convert CSV, INI, NDJSON, TOML, TSV, XML, or YAML to JSON. Paste the source or open a local file, then choose the parser and indentation settings. The conversion runs in your browser and does not upload the input.

How conversion works

Link

NDJSON becomes a JSON array. Each non-empty line is parsed as one independent JSON value, so objects, arrays, strings, numbers, booleans, and null are accepted. Blank lines are ignored. Invalid JSON stops the conversion and the error identifies the failing line.

CSV and TSV tables become arrays of objects when the first row supplies headers. Dots in a header create nested properties, so hello.there.general becomes hello, then there, then general. Columns with the same path are merged into one object. A backslash before a dot is also accepted as a separator. If the table has no header row, the values remain positional. CSV also supports a custom delimiter and custom headers. Turn on type inference to convert recognised numbers, booleans, and null values instead of keeping every field as text.

INI sections become nested objects. Keys outside a section appear under global, and all INI values remain strings. TOML tables, arrays of tables, and values map to JSON objects, arrays, and values. TOML comments and formatting do not survive the conversion. YAML mappings, sequences, and scalar values follow the same mapping.

XML elements become object properties. Repeated elements become arrays, and text becomes a string value. The attributes key, @attributes by default, holds XML attributes. Comments, processing instructions, namespaces, and the distinction between CDATA and ordinary text are not preserved.

Output options

Link

Choose tabs or zero to eight spaces for indentation. Zero spaces keeps line breaks but removes indentation. Formatting does not sort keys or change values. Invalid input produces an error instead of partial JSON.

If you only need to reformat, minify, or validate existing JSON, use the dedicated JSON formatter listed below.

What JSON can represent

Link

JSON is a plain-text format for structured data. A document contains one object, array, string, number, boolean, or null. Objects associate quoted property names with values, while arrays keep values in order.

{
  "id": 42,
  "name": "Example",
  "enabled": true,
  "tags": ["demo", "public"]
}

Strict JSON does not allow comments, trailing commas, single-quoted strings, unquoted property names, NaN, or undefined. It also has no built-in date or binary type. Applications usually store dates and binary data as strings according to an agreed convention.

Objects, arrays, and types

Link

An object key is always a string and must appear between double quotes. Key order is visible in the text, but software should not assign meaning to it unless an application contract says otherwise. Keys within one object should be unique. Parsers disagree about duplicates, and many silently keep only the final value.

Arrays preserve order and may contain different value types, although APIs commonly expect every item to have the same shape. JSON numbers use decimal notation and may include a fraction or exponent. Leading zeroes are not allowed except in zero itself. Strings use backslash escapes such as \n for a line break and \t for a tab.

Validation and common uses

Link

A JSON parser checks syntax, not whether the data has the fields an application needs. JSON Schema or application code must check required properties, value types, ranges, and other rules. This distinction matters when a document parses correctly but an API still rejects it.

Web APIs commonly use JSON for request and response bodies. Applications also use it for settings, lock files, test fixtures, localisation data, and static datasets. Its object and array model maps well to common programming-language data structures, which explains its broad support. The trade-off is that units, dates, identifiers, and versioning rules live outside the JSON grammar.

What may be lost

Link

A conversion can preserve values while losing details of the source notation. CSV and TSV provide little type information unless you enable inference. INI has only text values. XML attributes need the configured attributes key, while comments, element namespaces, and mixed content cannot be reproduced faithfully. YAML comments, anchors, aliases, tags, and scalar styles are discarded.

JSON numbers do not define a fixed precision. JavaScript cannot represent every integer above 9,007,199,254,740,991 exactly, so check large identifiers and precise numeric values. The converter also reads the complete input and output into memory, which makes it unsuitable for very large files.

Files, privacy, and saved work

Link

Select a file or drop it on the file control. A recognised extension selects the matching input type. The browser reads the file locally with FileReader and does not upload it.

The selected format, each format’s input, parser settings, and JSON formatting settings are stored in localStorage. Switching formats does not overwrite another format’s text or options. Clear the fields or site data after handling sensitive information on a shared device.

Link

Widget made with staark