JSON formatter and validator
Paste JSON and press Format. Valid JSON is indented and checked; an error shows the line, the column and the text around it so you can fix it fast.
- Format, validate, tree
- Free, no sign-up
Tree view
Runs in your browser. Nothing you type or open is uploaded. Free to use, no account. More developer tools
How to use it
- Paste or type JSON in the box.
- Press Format, Minify, or Repair and format for JSON with trailing commas or comments.
- Copy or download the result, or open the tree view to explore it.
Errors and repair
The validator uses your browser's strict JSON parser, the same rules an API uses, and points to the line and column of the first problem with a short excerpt. Common causes are a trailing comma, single quotes, a missing quote around a key, or a comment.
Repair and format fixes the usual hand-edited JSON problems: it removes comments and trailing commas, turns single-quoted strings into double-quoted ones and quotes bare keys, then validates the result. Sort keys orders object keys A to Z, which makes two JSON files easier to compare.
Private by design
Privacy
Everything runs in this page and stays on your device. Your JSON is formatted inside this page and kept in this tab only.
This page also shows Google ads, which can use cookies. Privacy and cookies explains how.
Questions
Why is my JSON invalid?
The most common causes are a trailing comma after the last item, single quotes instead of double quotes, keys without quotes, and comments. The error points to the exact place, and Repair and format fixes most of these.
Can it handle large files?
Yes, up to several megabytes, depending on your device. The tree view is limited to the first few thousand items to stay fast.
Does formatting change my data?
Formatting only changes spaces and line breaks. Sort keys changes the order of keys, which JSON does not treat as meaningful.
Can I convert JSON to Swift?
Use JSON to Swift Codable, which turns a JSON sample into Swift structs.