Skip to the tool
DevToolBench

JSON & data formats

Format, compare and escape JSON, and convert it to and from CSV, YAML, TOML and TypeScript, with the places where each conversion loses data.

Most JSON problems are one of three things: the document is not valid, two documents differ and nobody can see where, or the data has to become something else — a spreadsheet, a config file, a type. The tools here split along those lines, and every one of them parses the input before doing anything with it, so a stray trailing comma is reported as an error instead of being carried quietly into the output.

Start with the JSON formatter whenever a payload arrives minified or broken: it validates, pretty-prints and points at the line where parsing stopped. When the question is what changed between two responses, use JSON diff, which compares by value rather than by text, so key order and indentation stop mattering, and hands you the result as a JSON Patch. JSON escape covers the narrower job of turning a block of text into a valid string value, quotes, backslashes and newlines included — what you need when an error message or a template has to live inside another document.

Conversions are where data gets lost without anyone noticing. JSON to CSV has to flatten nested objects into columns, and the CSV can be perfect while Excel still strips the leading zero from a postcode on screen; the page explains how to import so that does not happen. CSV to JSON has the opposite problem, with quoted fields that contain commas or line breaks, which is why it reads the file character by character instead of splitting lines. JSON to YAML quotes the values YAML would otherwise misread — the country code NO turning into false is the famous one — and YAML to JSON resolves anchors and aliases, so you can see what a config file really expands to. JSON to TOML lists the path of every null, because TOML has no way to write one, and JSON to TypeScript infers interfaces from a sample, typing what it cannot pin down as unknown rather than any so the compiler still makes you check.

The XML formatter sits in this group because XML is still the payload of SOAP services, sitemaps, RSS feeds and Office documents. It indents or minifies a document and names the tag that broke it, which is quicker than counting lines and columns from a parser error.