HCODX / JSON Converter
100% browser-based · predictable conventions · UTF-8 safe

JSON Converter — JSON to CSV, YAML & XML

Convert between JSON, CSV, XML, and YAML in your browser. RFC 4180 CSV output, BadgerFish-style @attr/#text for XML, and js-yaml for YAML. Auto-detects input format, preserves your column order, and never silently restructures your data.

From
To
Drop a file
.json, .csv, .xml, .yaml, .yml, .txt
Input
Output
JSON output options
Detected
Input size
0 B
Output size
0 B
Status
Ready
Example

Predictable round-trip conventions

JSON ↔ CSV uses RFC 4180. JSON ↔ XML uses BadgerFish-style @attr / #text. JSON ↔ YAML uses js-yaml's defaults. Same input, same output, every time.

JSON
[
  { "name": "Alice", "age": 30, "active": true },
  { "name": "Bob",   "age": 25, "active": false }
]
CSV (RFC 4180)
name,age,active
Alice,30,true
Bob,25,false
XML in
<?xml version="1.0"?>
<user id="1">Ada Lovelace</user>
JSON out
{
  "user": {
    "@id": "1",
    "#text": "Ada Lovelace"
  }
}
Use cases

What you'll actually use this for

Data interop is mostly format translation. Here's where this tool fits.

API JSON → spreadsheet CSV

Drop an API response in, paste the CSV into Excel / Sheets / Numbers. Column order matches your input. No surprise reordering.

CSV upload → JSON payload

Convert a hand-written or exported CSV into the shape your API expects — array of objects, headers as keys, types inferred where unambiguous.

YAML config → JSON

Translate a Kubernetes manifest, GitHub workflow, or Compose file into JSON for tools that want it in that shape.

JSON → readable YAML

Convert a noisy JSON config to YAML for easier human reading, with anchors for shared sub-trees if you want them.

Legacy XML feed → modern JSON

Convert a SOAP or RSS payload into clean JSON. Attributes become @-prefixed keys, text content becomes #text, repeated tags become arrays.

Round-trip diffing

Convert in, convert back. If the round-trip changes anything, you've found a structural quirk worth investigating.

Step by step

How to use the converter

Pick formats, paste input, click Convert.

1

Choose From / To formats

Leave From on Auto-detect and the tool figures it out — or pick a specific format if your input is ambiguous.

2

Paste or drop your data

The left editor accepts pasted text or file drops. The output editor format-specific syntax highlighting updates automatically.

3

Configure options

The format-specific options card switches based on your To selection — JSON indent, CSV delimiter, XML root name, YAML line width, etc.

4

Convert and copy

Click Convert. The output editor toolbar lets you copy or download with the right extension. Use output as input reverses the direction for round-trip experiments.

FAQ

Frequently asked questions

Everything worth knowing about format conversion.

It tries parsers in order and picks the first that succeeds:

  1. JSON — strict JSON.parse
  2. YAMLjs-yaml.load succeeds and returns an object/array (not just a scalar)
  3. XMLDOMParser with no parsererror node
  4. CSV — fallback if input has commas / tabs and parses to ≥ 1 row via Papa Parse

If detection guesses wrong, override the dropdown.

RFC 4180 — the standard.

  • First row is the header (unless you override).
  • Cells containing the delimiter, quote, or newline are wrapped in double quotes.
  • Embedded quotes are escaped by doubling: he said "hi""he said ""hi""".
  • Line endings configurable: LF (Unix-friendly default) or CRLF (strict RFC).
  • Type-coercion of unambiguous numbers and booleans on input.
  • Column order is preserved from your input. The OLD version put id/name/title first regardless of input — that's gone.

Using a clean BadgerFish-style convention:

  • Keys starting with @ are attributes
  • The key #text is element text content
  • Repeated child elements become arrays

So <user id="1">Ada</user>{"user": {"@id": "1", "#text": "Ada"}}. This round-trips reliably in both directions.

They should — column order follows the keys of the first object in your JSON array, with any additional keys appended in the order they first appear.

If you want sorted columns, use the Sort keys option in the JSON output card before converting.

No. The cleanup walks the source character by character with full string-literal state tracking — it only strips comments and trailing commas outside of strings. URLs containing // and string values containing , } are preserved verbatim.

With Flatten nested objects enabled (the default), nested objects become dot-notation columns: {user: {name: "Ada"}} becomes a column called user.name.

Arrays are JSON-stringified into a single cell — that's the only safe round-trip representation in CSV. (The OLD version joined arrays with ;, which conflicts with semicolon delimiters and isn't reversible — fixed.)

No. js-yaml, Papa Parse, and the rest of the conversion logic all run in your browser. The libraries are loaded as static JS from a CDN; nothing is uploaded.

Limited by browser memory. Tens of megabytes work; larger files may freeze the page temporarily. For very large files, prefer a CLI: jq for JSON, csvkit or miller for CSV, xmlstarlet for XML, yq for YAML.

About

About data format conversion

JSON, CSV, XML, and YAML cover most of the structured-data landscape outside binary formats. Converting cleanly between them sounds easy and frequently isn't — each has features the others don't, and lossy mapping has to be deliberate.

Where lossy conversions happen

  • CSV is flat. Nested objects and arrays don't fit naturally; this tool flattens objects with dot-notation and JSON-stringifies arrays into a single cell. Round-trip CSV → JSON → CSV is faithful for shallow data but doesn't recover original nesting from a flattened column.
  • XML distinguishes attributes from child elements. JSON doesn't. The @attr / #text convention bridges the gap — round-trips work in both directions when both sides agree on the convention.
  • YAML supports anchors (&ref) and references (*ref) that resolve to shared structure. JSON has no such concept; the conversion always produces a fully-expanded JSON tree.

Where surprising data loss can happen

  • Numbers: large integers (> 2⁵³) lose precision in JavaScript. JSON.parse and JSON.stringify can't represent them faithfully — use string fields instead in those cases.
  • Dates: JSON has no date type. ISO-8601 strings are the safe lingua franca.
  • YAML implicit types: NO, off, yes become booleans by default in YAML 1.1; 2024-01-01 becomes a date. js-yaml uses YAML 1.2 semantics here, which is closer to JSON's type system. Watch for surprises with old YAML documents.
  • CSV types: this tool uses Papa Parse with dynamicTyping, so "42" becomes 42 and "true" becomes true. If you need everything as strings, disable that option in the CSV card.

Conventions used here

CSV: RFC 4180. Header row in first line. Cells quoted only when needed; embedded quotes doubled. Configurable delimiter and line ending.

XML: Attributes prefixed with @ in JSON. Element text in #text. Repeated children form arrays. The XML declaration is included by default.

YAML: js-yaml 4.1 with default schema. 2-space indent, no flow level (block style), 80-character line wrap. All knobs configurable in the YAML card.

JSON: Strict by default. Optional, opt-in tolerant pre-pass strips comments and trailing commas using string-aware character walk — won't corrupt URLs or quoted text.