JSON / YAML / XML / CSV Converter

Share:

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

RT-DEV-074 · Developer Tools
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 13 Sep 2026 · Sources: RFC 8259 and ECMA-404 for JSON; the YAML 1.2 specification, with every behavioural claim on this page checked against the self-hosted js-yaml build it serves; W3C XML 1.0 (Fifth Edition) and the browser's DOMParser; RFC 4180 for the CSV dialect written and read
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 content and the tool will guess based on the first non-whitespace character.

Pick the output format

Click the desired output format above the right pane. The right pane re-renders on every keystroke as you edit the input.

Fix errors as you go

If the input doesn't parse, a red bar appears below the box carrying the parser's own message — which means its detail varies by format. JSON gives a character position, YAML gives line and column, XML reports the browser's parse error. CSV never fails: the parser accepts whatever it is given and treats the first row as headers, so a malformed file produces a wrong result rather than an error.

Copy or download

Copy the output to clipboard or download as a file with the correct extension (.json, .yml, .xml, .csv). The Pretty button toggles between minified and human-formatted output where supported.

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 still rules in older enterprise integrations, financial messaging (FIX, ISO 20022), and document publishing (Word, 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 (a real pain for config files), no multi-line strings without escaping, integers are limited to 53-bit precision in JavaScript engines (a problem for Snowflake IDs and 64-bit Bitcoin satoshi values). 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 the library this page loads parses under 1.2's core schema. Two that do happen are worth knowing, and both were checked against the loaded library rather than assumed. mode: 0777 parses as the decimal number 777, not as an octal permission — write 0o777 or quote it. And a bare 2026-09-13 is read as a timestamp, so converting to JSON yields "2026-09-13T00:00:00.000Z", a different string from the one you typed. Use YAML when the file is edited by hand more than it is generated by code.

XML — when you can't choose

XML (1998, refined 2008) remains entrenched in financial messaging (SWIFT MX, FIX protocol), 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 (some use double-quoting, some use backslash-escape), how to handle newlines inside fields, whether the first row is headers or data, and what character encoding the file uses (UTF-8 vs Latin-1 vs UTF-8-with-BOM). RFC 4180 (2005) specifies a canonical CSV form but is widely ignored. Excel's CSV export uses CRLF line endings and double-quote escaping; Linux tools usually produce LF endings; semicolons replace commas in some European locales. The tool above outputs RFC 4180-compliant CSV when converting from JSON arrays of objects.

Conversion is lossy

All four conversions here go through one in-memory value, so what survives is whatever that value can hold. The specific losses, read off this tool's own code rather than described in general:

XML attributes are not converted — they are discarded. The XML reader walks child elements and text only, so <user id="7">Alice</user> becomes "Alice" and the id is gone. That includes xmlns declarations, so namespaces go with them. The writer never emits an attribute either, which means XML → JSON → XML cannot preserve one even in principle.

XML has no arrays, so the reader guesses. A tag appearing more than once under the same parent becomes a list; a tag appearing once becomes a scalar. A collection that happens to contain a single item therefore comes back as an object rather than a one-element array — the classic reason a consumer breaks on the smallest input.

XML text is retyped by pattern. Anything matching all digits becomes a number, so a leading-zero identifier such as 007 comes back as 7; the literal text true and false become booleans. A product code and a quantity are indistinguishable to the reader.

CSV is strings in both directions. Reading CSV gives you an array of objects whose every value is text — numbers and booleans have to be retyped by you. Writing CSV requires an array of objects and refuses anything else, with the union of all keys as the header row; a nested value is written as embedded JSON rather than expanded.

Comments never survive, in any direction — including YAML to YAML. The YAML path is load-then-dump, so the round trip rebuilds the document from the parsed value and every comment is dropped. This page cannot be used to reformat a commented configuration file.

What each of these four formats quietly changes about your data

01

JSON was extracted from JavaScript by Douglas Crockford in 2001 and standardised as RFC 4627 in 2006, ECMA-404 in 2013, and RFC 8259 in 2017 — three formal standards for what looks like a one-page format.

02

YAML rejects a duplicate key; JSON accepts it. Paste a: 1 twice and this page stops with "duplicated mapping key". The same shape in JSON — {"a":1,"a":2} — parses silently to {"a":2}, because RFC 8259 only says names SHOULD be unique.

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.

04

JSON has no comment production at all — not in RFC 8259's grammar, not in ECMA-404's. That is why JSONC and JSON5 exist as separate formats rather than as options, 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. Under YAML 1.2's core schema a leading zero carries no meaning, so the value silently becomes decimal. Write 0o777 for octal, or quote it to keep the text. Verified against the loaded parser.

06

CSV has no formal specification until RFC 4180 in 2005 — and even that is "informational" not "standards-track." Every CSV-reading library has its own dialect.

07

JavaScript's JSON.parse() turns integers larger than 2^53 - 1 (~9 quadrillion) into incorrect floats. Bitcoin amounts in satoshis hit this limit; Twitter snowflake IDs do too.

08

A bare YAML date is a timestamp, not a string. d: 2026-09-13 converts to JSON as "2026-09-13T00:00:00.000Z" — a midnight in UTC that your source never wrote. Quote it if the date is a label rather than an instant.

09

XML attributes do not survive this converter. The reader walks elements and text only, so <user id="7">Alice</user> becomes just "Alice". Namespace declarations are attributes too, which is why they vanish with everything else.

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 scalar — the reason a consumer that works on ten records fails on the eleventh day when there is only one.

Frequently asked questions

JSON ↔ YAML does for values, though never for comments — see below. JSON ↔ XML does not: attributes are discarded rather than mapped, a one-element list becomes a scalar, and element text matching all digits is retyped as a number, so 007 returns as 7. JSON → CSV → JSON loses every type, because CSV carries only text. Decide the direction before you design the data, not after.
No hard cap, but very large inputs (above ~5MB) cause browser memory pressure. For routine config files (~100KB) the tool is instant. For multi-megabyte data dumps, use a server-side conversion instead.
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 a file that converts correctly here can still be misread there. Two 1.2 behaviours that do change your value: 0777 becomes decimal 777, and a bare 2026-09-13 becomes a timestamp.
No, and the reason is broader than namespaces: the XML reader walks child elements and text nodes only, so every attribute is discarded — <user id="7">Alice</user> becomes the string "Alice". An xmlns declaration is an attribute, so it goes the same way, and prefixed tag names arrive as literal text with the colon in them. The writer never emits an attribute either. If your XML carries meaning in attributes or namespaces — SOAP, most enterprise schemas, anything with an XSD — use a real XML toolchain rather than this converter.
RFC 4180 on output: comma delimiter, CRLF line endings, a header row, and double-quote doubling applied to any field containing a comma, a quote or a line break. On input it reads the same dialect and only that dialect — a semicolon-delimited European export or a tab-separated file will parse as a single column, silently, because CSV parsing here never fails. The header row is whatever the first line contains, and a nested value written out becomes embedded JSON inside one cell.
JavaScript's native number type loses precision above 2^53. For very large IDs (Twitter snowflake, Bitcoin satoshis) consider converting via a server tool that supports BigInt. This browser-only tool inherits JS's number limits.
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: js-yaml v4.3.2, served from this domain, for the YAML side. JSON uses the browser's own JSON object, XML uses its DOMParser, and the CSV reader and writer are a few dozen lines in the page. No third-party CDN is contacted for anything.

Method & sources

How it computes

Parses the input into one in-memory value and writes it back out in the chosen format: JSON via the browser's JSON object, YAML via a self-hosted js-yaml (YAML 1.2 core schema), XML via DOMParser on the way in and a plain element writer on the way out, CSV via a hand-written RFC 4180 reader and writer. Because everything passes through a single value, what survives a conversion is whatever that value can hold — attributes, comments and CSV types do not.

What this tool implements

  • JSON is RFC 8259 / ECMA-404 through the browser's own JSON object, so duplicate names resolve to the last and integers outside ±(2^53−1) are rounded.
  • YAML is the 1.2 core schema as implemented by the self-hosted js-yaml build. Every YAML claim on the page was executed against that exact file rather than recalled: NO, yes, on and off stay strings; 12:30:00 stays a string; 0777 becomes decimal 777; a bare date becomes a timestamp; a duplicate mapping key throws.
  • CSV output is RFC 4180 — comma delimiter, CRLF terminators, header row, and double-quote doubling for any field containing a comma, a quote or a line break. CSV INPUT accepts that dialect and only that dialect, and never reports an error, so a semicolon-delimited file parses as one column silently. The page says so.
  • XML input is the browser's DOMParser in application/xml mode, so a malformed document produces the engine's own parse error. The converter walks child elements and text nodes only: ALL attributes, xmlns declarations included, are discarded, and the writer emits none. Stated plainly rather than described as 'partial namespace support'.
  • XML has no array and no type system, so the reader infers both: a tag repeated under one parent becomes a list and a tag appearing once becomes a scalar; text matching all digits becomes a number (007 → 7) and the literals true/false become booleans. Both inferences are named on the page as the failure modes they are.
  • Comments are lost in every direction including YAML → YAML, because the YAML path is load-then-dump. Verified by execution. The page tells the reader not to use it to reformat a commented config file.

Sources

What can make this go out of date

  • None at runtime. One library is loaded, js-yaml, and it is served from this domain; JSON, XML and CSV use the browser or code in the page. No request is made while converting and the page works with the network disconnected.
  • The YAML behaviours documented on the page are properties of the vendored js-yaml build, not of YAML in the abstract. Upgrading that file could change them, which is why the freshness source names the library alongside the specification.

Abridged — the full review record for this tool runs longer than the list above.

Advertisement
Pre-footer · AD-W3 728 × 90