All Tools

CSV to JSON Converter: CSV, TSV, YAML and XML

Convert CSV to JSON and back, or between CSV, TSV, JSON, YAML and XML in any direction. Detects the delimiter, reads quoted fields, types numbers, flattens and nests JSON. Nothing is uploaded.

Drag files here, paste, or choose files

CSV, TSV, JSON, YAML or XML, up to 5.0 MB. Files stay on this device.

Paste CSV, TSV, JSON, YAML or XML here, or drop a file above.


    About the CSV to JSON Converter

    The CSV to JSON Converter turns spreadsheet exports into JSON, and converts between CSV, TSV, JSON, YAML and XML in any of the twenty directions. Paste text or drop a file, pick From and To, and the result updates as you type. Copy it, or download it under the name of the file you dropped with the new extension.

    Nothing is uploaded; every conversion runs in your browser and never leaves your device.

    How to use it

    Reading CSV and TSV

    The reader follows RFC 4180 and common practice. A byte order mark is dropped, and lines may end with CRLF, LF or CR. A field that starts with a quote may hold commas, line breaks and doubled quotes, so "Lee, Jr." stays one field. With First row is a header on, each row becomes an object keyed by the header; with it off, each row becomes an array. A row shorter than the header is padded with empty fields and reported as a warning, while a row longer than the header is refused with its row number.

    The delimiter

    Auto-detect tries comma, semicolon, tab and pipe on the first 20 lines and keeps the one that gives the most rows with the same number of fields. A tie goes to the earlier one in that list. European exports that use semicolons and decimal commas, such as 1,5;2, are read correctly.

    Numbers and true or false

    With type detection on, an unquoted true or false becomes a boolean, and a field such as 31 or -2.5 becomes a number, but only when nothing would be lost. 007, 1,5, and integers larger than 2^53 stay text, and empty fields stay empty strings.

    Nested JSON

    Writing CSV flattens nested JSON into dotted columns such as user.name and numbered columns such as tags.0. Tick Nest dotted headers when reading CSV to rebuild the nesting. Keys that contain a dot are written in quotes so the round trip stays lossless.

    YAML and XML

    YAML uses a safe subset of YAML 1.2: block mappings and lists, one-line flow lists and maps, quoted and plain scalars, | and > block scalars and comments. Anchors, aliases, tags and several documents in one file are refused with their line number. XML elements become objects, attributes become @ keys, repeated elements become lists and values stay strings. When JSON becomes XML, a list is written as <rows> holding one <row> per item, and a key that is not a valid XML name, such as first name, is written as first_name with a warning.

    Limits

    Text and files up to 5 MB are converted on this device. A file that holds NUL bytes, such as an image, is refused because it is not text. Errors are shown next to the input with the line and column where possible, and no stale output is left on screen.

    Related tools

    To flatten JSON for a spreadsheet, the JSON to CSV page explains columns and the formula guard. To tidy JSON or XML without changing its format, use the JSON formatter or the XML formatter.

    Frequently asked questions

    How do I convert CSV to JSON?

    Paste the CSV or drop the file, keep From on CSV and To on JSON, and the JSON appears as you type. With the header row on, each row becomes an object keyed by the column names; with it off, each row becomes an array.

    Which delimiter does it use?

    Auto-detect tries comma, semicolon, tab and pipe on the first 20 lines and keeps the one that gives the most rows with the same number of fields. A tie goes to the earlier one in that list. You can also choose the delimiter yourself.

    Why does 007 stay a string?

    Type detection only turns a field into a number when nothing is lost. A leading zero, a decimal comma such as 1,5, or an integer larger than 2^53 would change, so those stay text. Quoted fields are never typed. Turn detection off to keep every value as text.

    Which YAML does it read?

    A safe subset of YAML 1.2: block mappings and lists, one-line flow lists and maps, quoted and plain scalars, block scalars with | and >, and comments. Anchors, aliases, tags and several documents in one file are refused with the line number, never read the wrong way.

    How is XML turned into JSON?

    Each element becomes an object, attributes become keys that start with @, repeated elements become a list and text beside children goes in #text. Values stay strings, because XML has no types. For CSV the repeated children of the root become the rows.

    Is my data uploaded?

    No. The converter reads the text or file in your browser and writes the result there too. Nothing is sent to a server, so you can convert exports that hold customer or company data.

    Other related tools