JSON Formatter & Converter
Format/minify JSON and convert between YAML, CSV, XML. Auto-detects format on paste.
Result will appear here.
About JSON Formatter & Converter
All processing happens in your browser. Data is never sent to a server, so sensitive information stays safe.
Smart Input Detection
Paste any text and the tool will auto-detect its format (JSON/YAML/CSV/XML) and switch tabs accordingly.
FormatterㆍMinifier
Indent JSON for readability or strip whitespace to minimize file size.
JSON ↔ YAML
Convert between YAML (popular for config files and CI pipelines) and JSON in either direction.
JSON ↔ CSV
Convert an array of JSON objects into a CSV table, or parse CSV back to JSON. The first row is treated as the header.
XML ↔ JSON
Parse XML into a JSON tree, or serialize a JSON object back into XML. Attributes use the @ prefix.
Need to format SQL queries working with JSON columns? Try the SQL Formatter. For unique keys in JSON objects, use the UUID Generator. To encode text or files to Base64, see the Base64 Encoder/Decoder.
Common JSON Parsing and Authoring Pitfalls
JSON looks simple, but even a small deviation from the spec (RFC 8259 / ECMA-404) makes parsers reject the input. The most frequent mistakes come from confusing JSON with JavaScript object literals.
Things JSON does not allow
- Comments - Neither
// ...nor/* ... */are valid. If you need annotations, use JSON5 or a dedicated field like"_comment". - Trailing commas -
{"a": 1, "b": 2,}is invalid. JavaScript allows it, so this mistake is common when copy-pasting from JS code. - Single quotes - Strings require double quotes.
{'name': 'kim'}is not JSON. - Unquoted keys -
{name: "kim"}is a JavaScript object literal, not JSON. Every key needs double quotes. - NaN, Infinity, and undefined - These values do not exist in JSON.
JSON.stringify({a: NaN})produces{"a":null}, not an error. - Hexadecimal and octal numbers - Notation like
0xFFor0o17is not allowed. Only decimal numbers are valid.
Encoding and escaping traps
- UTF-8 BOM - A byte order mark at the start of a file causes some parsers to reject the input. UTF-8 without BOM is the standard for JSON files.
- Unescaped backslashes - A backslash in a string must be written as
\\. The Windows pathC:\Usersmust become"C:\\Users". - Literal newlines inside strings - Actual newline characters are not allowed inside a JSON string. Use the two-character escape sequence
"\n". - Unicode surrogate pairs - Characters outside the Basic Multilingual Plane (such as most emoji) are represented as two 16-bit surrogate values. A lone surrogate is invalid JSON.
Conversion scenarios that frequently fail
- JSON to CSV with nested objects - CSV is flat; nested objects and arrays cannot be represented directly. Flatten keys (e.g.,
user.name) or encode nested values as JSON strings. - YAML to JSON with indentation issues - YAML defines structure through indentation. Mixing tabs and spaces causes parse failures. JSON-to-YAML is safe; always validate the reverse direction.
- XML to JSON attribute vs element ambiguity - XML can express the same data as an attribute or a child element. Round-tripping through XML-to-JSON-to-XML may not produce identical output.
- Large integer precision loss - JSON numbers are treated as IEEE 754 double-precision floats. Integers above 2^53 lose precision. Store large IDs as strings.
Schema and validation mistakes
- No schema enforcement - Shape mismatches between client and server only surface at runtime. JSON Schema (or TypeScript types) catches them earlier.
- null vs missing key -
{"a": null}and{}are different. Make the distinction explicit in your API contract. - Inconsistent key casing - Mixing
userName,username, anduser_namein the same response complicates client-side parsing. Standardize on camelCase or snake_case.
FAQ
Is my data sent to a server?
No. All conversion runs in your browser via JavaScript and never leaves your device.
Does it support JSON5 or commented JSON?
Only standard JSON is supported. Comments and trailing commas will cause a parse error.
Can it handle large JSON files?
Up to a few megabytes works smoothly in the browser. Beyond ~10MB, formatting and tree rendering may slow down - paste only the relevant section instead.