AutoSocialSyncGuides Reviews & Tools
HomeFeaturesToolsAI Text DetectorText to VoiceCharacter CounterAI ChatGuidesReviewsNewsResourcesAbout UsInternet Speed Test
Sign InSign Up
Free developer tool Β· runs in your browser

JSON & XML Formatter & Validator

Paste messy code and get it beautified, validated or fixed in an instant. Find errors by line and column, convert JSON to XML and back, and explore your data as a tree.

BeautifyMinifyValidateAuto-fixSort keysJSON ⇄ XMLTree view100% private
Valid JSON28 keys Β· 8 objects Β· 3 arrays Β· depth 6

Input JSON

410 B1 lines410 charactersCtrl + Enter = Beautify

Output Beautified JSON

{
  "store": {
    "name": "Demo Gadgets",
    "open": true,
    "rating": 4.8,
    "location": {
      "city": "Berlin",
      "country": "DE"
    }
  },
  "orders": [
    {
      "id": 1001,
      "customer": "Anita Gurung",
      "items": [
        {
          "sku": "KB-01",
          "qty": 2,
          "price": 29.99
        },
        {
          "sku": "MS-07",
          "qty": 1,
          "price": 14.5
        }
      ],
      "paid": true,
      "coupon": null
    },
    {
      "id": 1002,
      "customer": "Ravi Thapa",
      "items": [
        {
          "sku": "HD-22",
          "qty": 1,
          "price": 89
        }
      ],
      "paid": false,
      "coupon": "WELCOME10"
    }
  ],
  "updated": "2026-11-17T09:30:00Z"
}
750 B45 lines
28Keys
8Objects
3Arrays
10Strings
9Numbers
3Booleans
1Nulls
6Max depth
Everything in one box

A JSON and XML toolkit that does the boring work for you

No signup, no ads in your way, no upload. Open the page, paste your code and work.

Beautify & pretty print

Turn one unreadable line into clean, indented code with 2 spaces, 4 spaces or tabs. Long XML tags wrap automatically.

Minify

Strip every extra space and line break to shrink payloads for APIs, configs and storage. See how much smaller it got.

Validate with exact errors

Get the precise line and column, a plain-English explanation and a code frame that points at the problem. Jump to it in one click.

Auto-fix broken JSON

Repairs comments, single quotes, unquoted keys, trailing and missing commas, True/None, undefined and more, and tells you what it changed.

Sort keys A→Z

Sort every object in your JSON alphabetically so two files are easy to compare and diffs stay small.

JSON ⇄ XML converter

Convert JSON to XML and XML to JSON in one click. Attributes, text, repeated elements and CDATA are handled.

Tree view

Explore large documents as a collapsible tree. Expand all, collapse all and see object and array sizes at a glance.

Private by design

Your code is processed in your browser. Nothing is uploaded to a server, and big numbers keep every digit.

How it works

Format and validate JSON in 3 steps

Paste or drop your code

Paste JSON or XML into the Input box, press the paste button, or drop a file. The type is detected for you.

Pick what you need

Beautify, Minify, Validate, Auto-fix, Sort keys or Convert. The result updates live as you type.

Copy or download

Copy the output, download it as a file, or send it back to the input to keep working on it.

Troubleshooting

The most common JSON errors and how to fix them

Most β€œinvalid JSON” messages come from the same handful of mistakes.

ProblemWhat it looks likeHow to fix it
Trailing commaA comma before } or ]Remove the last comma, or use Auto-fix.
Single quotes{'name': 'Alex'}JSON needs double quotes: {"name": "Alex"}.
Unquoted keys{name: "Alex"}Wrap every property name in double quotes.
Missing commaTwo properties with nothing between themAdd a comma after the first value.
Comments// note or /* note */JSON has no comments. Delete them, or use Auto-fix.
Raw line break in a stringA real new line inside "text"Write it as \n inside the string.
undefined, NaN, True, NoneValues copied from JavaScript or PythonUse null, true and false in lower case.
Leading zeros007 or 01Write 7 or 1. Or make it a string: "007".
Unclosed bracketA { or [ that never endsThe error points to where it started. Add the missing } or ].
Quick comparison

JSON vs XML: which one do you have?

JSON

Light, easy to read and the default format for web APIs and modern config files.

  • Objects, arrays, strings, numbers, true, false and null
  • No comments and no trailing commas
  • Smaller than the same data in XML

XML

Tag-based and strict about structure. Common in feeds, SOAP services, office files and older systems.

  • Elements, attributes, text, CDATA and comments
  • One root element, and every tag must be closed
  • Tag names are case-sensitive
FAQ

JSON and XML formatter questions, answered

Is my data sent to a server?

No. The formatter, validator and converter run entirely in your browser, so the text you paste or the file you open is never uploaded. You can safely use it with private configs, but never share secrets such as passwords or API keys with anyone.

How do I format JSON online?

Paste your JSON into the Input box (or drop a .json file). The Output box shows it beautified straight away. Choose Beautify, Minify, Sort keys or a different indent size at any time, then copy or download the result.

How do I find the error in my JSON?

The status bar shows whether the code is valid. If it is not, you get the line and column, a short explanation and a code frame that marks the exact spot. Press Jump to error to select it in the editor.

What does Auto-fix repair?

It removes comments, converts single quotes to double quotes, adds quotes around property names, removes trailing commas, adds missing commas between properties, lower-cases True, False and None, replaces undefined, NaN and Infinity with null, and tidies number formats. It lists every change it made, so check the result before you use it.

How does JSON to XML conversion work?

Each key becomes an element. Keys that start with @ become attributes and #text becomes the element's text. Arrays become repeated elements with the same name, and null becomes an empty element. A JSON document with several top-level keys is wrapped in a <root> element.

How does XML to JSON conversion work?

Attributes become keys that start with @, text becomes a string (or #text when the element also has attributes or children), and repeated elements become an array. All values come out as text, because XML has no number or boolean types.

Does it change my numbers?

No. Numbers are kept exactly as you wrote them, so a very long ID like 12345678901234567890 is not rounded the way JavaScript would round it.

Does it support comments or JSON5?

Strict validation follows the JSON standard, so comments, trailing commas and single quotes are reported as errors. Switch on Auto-fix to turn JSON5-style or JavaScript-style text into valid JSON.

How large a file can I use?

Up to about 10 MB of text. Very large results are not drawn on the page, but Copy and Download still work. The tree view is limited to 40,000 nodes.

Is it free?

Yes. The JSON and XML formatter is free to use with no signup.