JSON / YAML / XML / CSV Converter

Share:
Developer Tools

JSON / YAML / XML / CSV Converter

Convert between JSON, YAML, XML, and CSV. Auto-detect input format, side-by-side editors, all client-side.

By Checked against sources by Last reviewed DEVELOPER JSON XML YAML
Your browser is too old for this tool’s interactive features. Please update to Safari 13.1, Chrome or Edge 80, Firefox 74 or newer.

Data Format Converter Tool

    📅 Research current as of 06 Nov 2026 · Sources: RFC 8259 for JSON, read without rounding; YAML 1.2.2 core schema (§10.3), every YAML claim on this page run against the self-hosted js-yaml it serves; XML 1.0 (Fifth Edition) and Goessner's XML-to-JSON patterns for the attribute and text mapping; RFC 4180 for CSV
    Standards, published formulas, and reference data are revised over time — check against a current authoritative source before relying on these figures.
    Advertisement
    After results · AD-W1 Responsive · Post-tool — peak engagement

    How to use the data format converter

    Pick the input format

    Click JSON, YAML, XML or CSV above the left pane, or paste: on paste the format is read from the text (a leading < is XML, { or [ is JSON, a key: line is YAML, consistent columns are CSV) and a note says what was chosen. A click overrides it.

    Pick the output format

    Click the output format above the right pane. It updates as you type. Under it, a list says everything the conversion changed or could not carry: a duplicate name, a number JavaScript would round, an XML comment dropped, a renamed element.

    Fix errors as you go

    If the input does not parse, a red bar under the box gives the reason. JSON and YAML give the line and column; XML gives the browser's own parse error. CSV always produces a table, but a quote that never closes, a stray quote or a row with the wrong number of fields is listed with its line.

    Copy or download

    Copy the output to clipboard or download as a file with the correct extension (.json, .yml, .xml, .csv). Minify writes JSON and XML without indentation; YAML and CSV have one layout.

    Advertisement
    After how-to · AD-W2 Responsive

    JSON, YAML, XML, CSV — picking the right format

    Data interchange formats are not interchangeable. JSON dominates web APIs and JavaScript ecosystems. YAML dominates devops config (Kubernetes, Docker Compose, GitHub Actions). XML is still common in enterprise integrations, ISO 20022 payment messages and document formats (DOCX, RSS, Atom). CSV is the universal spreadsheet exchange format despite being technically the worst-defined of the four. Knowing when each is the right choice — and when conversion is lossy — saves hours of integration debugging.

    JSON — the default for new code

    JSON (ECMA-404, 2013) is the right choice for new APIs, configuration files in JavaScript/TypeScript projects, and any data exchange where machine-parsing matters more than human readability. It's small (no closing tags), unambiguous (every value has exactly one type representation), and supported natively by every modern programming language. The trade-offs: no comments, no multi-line strings without escaping, and a number grammar with no size limit that most JavaScript readers squeeze into a 64-bit float, so an integer above 253 − 1 (9,007,199,254,740,991) silently changes. RFC 8259 §6 calls only that range interoperable. This page never converts a number through a float: the digits you wrote are the digits written out. Use JSON when machines read it more than humans do.

    YAML — when humans edit the file

    YAML 1.2 (2009) was designed for human-edited configuration. It supports comments, multi-line strings, anchors and aliases (DRY config), and a less-noisy syntax than JSON. It's why Kubernetes manifests, Docker Compose files, GitHub Actions workflows, and Ansible playbooks all use YAML. The cost is that types are inferred from what a value looks like, so the text you wrote and the value you get are not always the same thing. Which surprises apply depends on the YAML version: the famous ones — NO becoming false, yes/on/off becoming booleans, 12:30:00 becoming a sexagesimal number — are YAML 1.1 behaviours and do not happen here, because this page reads YAML with the 1.2.2 core schema exactly: its int and float patterns and nothing else. That has two consequences worth knowing. mode: 0777 is the decimal number 777, not an octal permission; write 0o777 or quote it. And YAML 1.1-only forms such as 1_000 or 0b101 stay strings, where the library on its own would have read them as numbers. A bare 2026-11-06 stays the text you wrote: timestamps are not in the core schema. Going the other way, any string a YAML 1.1 reader could take for a number, a boolean or a date (NO, yes, 1_000, 2026-11-06) is written in quotes, so the file means the same to an older parser. Use YAML when the file is edited by hand more than it is generated by code.

    XML — when you can't choose

    XML (1998, fifth edition 2008) remains common in payment messaging (ISO 20022), document publishing (DOCX, ODT, RSS, Atom feeds), and older enterprise B2B (SOAP web services). Its strengths are namespaces (so XML documents can mix vocabularies from different schemas), attributes vs elements (semantic distinction), and the most-developed schema/validation ecosystem (XSD, DTD, RELAX NG). Its weakness is verbosity — every element is named twice — though how much larger a document gets depends entirely on how deeply it nests and how long the tag names are, so the percentages people quote are not worth repeating. For new code XML is rarely chosen; for talking to systems that already speak it, conversion remains useful.

    CSV — the eternal compromise

    CSV looks simple — comma-separated values, one row per line — but the simplicity is illusory. Different tools disagree about how to escape commas inside fields (double-quoting or a backslash), how to handle newlines inside fields, whether the first row is headers, which delimiter to use, and whether the file starts with a byte order mark. RFC 4180 (2005) describes the common form, but as an Informational memo, not a standard. This page reads quoted fields by its rules, detects comma, semicolon, tab or pipe and says which it found, removes a byte order mark, and writes RFC 4180 with CRLF line endings.

    Conversion is lossy

    Every conversion here goes through one in-memory tree that keeps member order, duplicate names and each number's exact digits, so what is lost is only what the target format cannot hold. Those losses, read off the converter's own code:

    XML attributes become @name members, and come back. The mapping is the one Stefan Goessner set out in 2006: <user id="7">Alice</user> becomes {"user": {"@id": 7, "#text": "Alice"}}, an empty element becomes null, and the root element is the one top-level key. Namespace declarations are attributes, so xmlns survives as @xmlns and prefixed names keep their colon. JSON → XML reverses it.

    XML has no arrays, so the reader still has to guess. A tag appearing more than once under the same parent becomes a list; a tag appearing once becomes a single value. A collection that happens to contain one item therefore comes back as an object rather than a one-element array, which is the classic reason a consumer breaks on the smallest input. When text sits between child elements, it is kept as #text but its position is lost, and the notes say so.

    XML text is typed only if you ask. With "Read numbers and true/false" on, text that is exactly a JSON number becomes a number, with its digits kept, and true or false become booleans. 007 is not a JSON number, so it stays the text "007". Untick the box to keep every value as text.

    CSV is strings in both directions. Reading CSV gives an array of objects whose every value is text. Writing CSV takes an array of objects (the columns are every name in the order first seen), an array of arrays (row by row) or one object (one row); a nested value is written as JSON inside its cell.

    Comments never survive, in any direction — including YAML to YAML. The YAML path parses to a value and writes a new document, so every comment is dropped. Do not use this page to reformat a commented configuration file.

    What each of these four formats quietly changes about your data

    01

    RFC 4627 first described JSON and registered application/json. RFC 7159 replaced it and RFC 8259 (December 2017) replaced that, while ECMA-404 describes the same grammar for Ecma: one small format, four documents.

    02

    YAML rejects a duplicate key; JSON allows one. Paste a: 1 twice and this page stops with "duplicated mapping key". In JSON, {"a":1,"a":2} is legal, because RFC 8259 only says names SHOULD be unique; JSON.parse keeps the last. This page keeps both for JSON → JSON, and names the line.

    03

    The Norway problem is a YAML 1.1 problem, and this page is not affected. Checked against the loaded library: country: NO yields the string "NO", and yes, on and off stay strings too. A 1.1 parser elsewhere in your pipeline will still turn them into booleans, so this page quotes them when it writes YAML.

    04

    JSON has no comment syntax at all, in RFC 8259 or ECMA-404. That is why JSONC and JSON5 exist as separate formats, and why a config file with comments in it is not, strictly, JSON.

    05

    mode: 0777 is the number 777 here, not an octal permission. YAML 1.2's core schema writes octal as 0o777; a leading zero alone means nothing. Quote the value to keep the text.

    06

    CSV had no written specification until RFC 4180 in 2005, and that memo is Informational, not a standard. Every CSV library still has its own dialect.

    07

    JSON.parse() rounds an integer above 253 − 1 to the nearest float it can hold, so 9007199254740993 reads back as 9007199254740992. Try the first preset: this page writes the id out exactly and adds a note.

    08

    A bare YAML date is a string under the 1.2 core schema. d: 2026-11-06 converts to JSON as "2026-11-06". YAML 1.1 had a timestamp type that read it as midnight UTC, which is why this page quotes date-like strings when it writes YAML.

    09

    XML attributes become @ members. <user id="7">Alice</user> converts to {"user":{"@id":7,"#text":"Alice"}} and back again: the mapping Stefan Goessner described on XML.com in 2006.

    10

    XML has no array, so a one-item list comes back as an object. The reader makes a list only when a tag repeats under the same parent. A collection of one therefore converts to a single value, the reason a consumer that works on ten records fails on the day there is only one.

    Frequently asked questions

    JSON ↔ YAML does for values, member order and number digits, though never for comments. JSON ↔ XML keeps attributes (as @name), text and digits, but a one-element list comes back as a single value, and with number reading on, 12 and "12" both come back as the number 12. JSON → CSV → JSON loses every type, because CSV carries only text. Decide the direction before you design the data, not after.
    There is no cap, but the page converts on every keystroke, in your browser's memory, so a very large file will feel slow to edit here. Paste it whole rather than typing into it.
    It does not arise. The library loads under YAML 1.2's core schema, so country: NO gives the string "NO", and yes, on and off stay strings as well — all four checked directly against the copy this page serves. The catch is that a YAML 1.1 parser at the other end of your pipeline will still read them as booleans, so when this page writes YAML it quotes them, and other strings a 1.1 parser would retype, such as 1_000 or 2026-11-06. One 1.2 behaviour that does change your value: 0777 becomes decimal 777.
    It carries them, without interpreting them. An xmlns or xmlns:x declaration is an attribute, so it becomes an @xmlns member, and a prefixed name such as x:item keeps its prefix, so JSON → XML writes the same declarations and names back. What it does not do is resolve which namespace a name belongs to or validate against a schema. For SOAP or anything with an XSD, use an XML toolchain.
    It writes the RFC 4180 form: commas, CRLF line endings, a header row, and quotes around any field holding a comma, a quote or a line break, with quotes doubled. It reads quoted fields by the same rules and detects the delimiter (comma, semicolon, tab or pipe), saying which it chose, and it lists any line that breaks the quoting rules. A nested value written out becomes JSON inside one cell.
    Exactly. JSON numbers are carried as the digits you wrote and YAML integers are read with BigInt, so a 64-bit id such as 12345678901234567890 comes out unchanged in every format. The notes still warn when an integer is outside the range RFC 8259 calls interoperable, because the program that reads the output may round it. A YAML .inf or .nan has no JSON form and is written as null, with a note.
    They are always lost, including YAML → YAML. Every conversion parses the input to a value and writes a new document from that value, and a comment is not part of the value — so selecting YAML on both sides still returns your file with the comments stripped. Checked directly: a document reading # hello then a: 1 # inline comes back as a: 1 and nothing else. Do not use this page to reformat a commented configuration file.
    No. The tool converts between JSON, YAML, XML and CSV only. TOML would need a parser this page does not load, and there is no date by which it will.
    Yes, once the page is loaded. All parsing and conversion happen in your browser via self-hosted libraries. You can disconnect your network and continue using the tool.
    One library: js-yaml v4.3.2, served from this domain, for the YAML side. JSON is read and written by this site's own RFC 8259 parser, XML by the browser's DOMParser, and CSV by this site's RFC 4180 reader. No third-party server is contacted for anything, and nothing you type is sent anywhere.

    Method & sources

    How it computes

    Every format passes through an RFC 8259 tree from RECATOOLS's own JSON parser (member order, duplicate names and number digits kept). YAML: js-yaml with the 1.2.2 core schema int/float rules (BigInt-exact) plus merge, written out with 1.1-ambiguous strings quoted. XML: DOMParser, Goessner 2006 mapping (@attr, #text, repeats → array), one root. CSV: RECATOOLS's own RFC 4180 parser, delimiter detected.

    What this tool implements

    • JSON is read and written (RFC 8259): numbers are carried as their digits, duplicates are kept and reported with line and column, integers outside ±(2^53−1) are reported (§6). No value passes through JSON.parse.
    • YAML 1.2.2 core schema, §10.3.2: int [-+]?[0-9]+ | 0o[0-7]+ | 0x[0-9a-fA-F]+ and the core float pattern replace js-yaml's own (which also accepts 1.1 forms), constructed with BigInt; no timestamp type, so a bare date stays text; the merge key is kept. Written YAML quotes any string a 1.1 reader (yaml.org/type/bool, /int) would retype.
    • XML mapping after Goessner, Converting Between XML and JSON (XML.com, 2006), patterns 1-7: <e/> → null, attributes → "@name", text beside attributes or children → "#text", repeated children → array; the root element is the one top-level key; output always has exactly one root. Optional number/boolean reading uses the JSON number grammar, so 007 stays text.
    • XML 1.0 (Fifth Edition): names checked against the Name production and renamed when illegal; CR written &#13; (§2.11), TAB and LF in attributes written as references (§3.3.3); characters outside Char become U+FFFD.
    • CSV: RFC 4180 quoting, delimiter detected among , ; TAB | with the reason shown; output RFC 4180 with CRLF; formula-looking cells counted (OWASP CSV Injection), never altered.
    • Corrected 2026-11-06: JSON.parse rounding and duplicate loss; DEFAULT schema described as core (dates became timestamps, 1_000 a number); several XML root elements; illegal element names; attributes and xmlns discarded; 007 → 7; comma-only CSV; auto-detect promised but never wired.

    Sources

    What can make this go out of date

    • None at runtime. js-yaml is served from this domain; JSON and CSV are handled by this site's own code; XML uses the browser's DOMParser. The page makes no request while converting and nothing typed is sent anywhere.
    Advertisement
    Pre-footer · AD-W3 728 × 90