JSON Formatter
Format JSON online: beautify messy JSON with 2 or 4 spaces or tabs, sort keys, minify it to one line and find errors. Free, runs in your browser.
Check if JSON is valid and see the exact line and column of any error, with a hint on how to fix it. A free online JSON validator in your browser.
Runs in your browser. Your data never leaves your device.
Paste JSON and the validator tells you straight away whether it is valid. If it isn't, you get the line and column of the first error, the lines around it with a marker under the problem, and a plain-English hint: a trailing comma, single quotes, a missing value, a comment, or True instead of true. Valid JSON shows its type, number of keys, depth and size, so you can confirm you pasted all of it.
A validator checks syntax: that the text follows the JSON rules, so any program can parse it. It doesn't check what the data means. Checking that a price is a number above zero, or that an email field is present, is a job for JSON Schema.
Most invalid JSON comes from a few mistakes: a comma after the last item, single quotes instead of double quotes, keys without quotes as in JavaScript code, comments, a missing comma between items, a line break inside a string, and NaN, undefined or True, which are not JSON. The validator gives you the fix for each; most are one character.
// invalid
{ name: 'Sara', "tags": ["a", "b",], }
// valid
{ "name": "Sara", "tags": ["a", "b"] } In code, parse the JSON and catch the error; both languages tell you the line and column.
# Python
import json
try:
with open("data.json", encoding="utf-8") as f:
json.load(f)
print("valid")
except json.JSONDecodeError as e:
print(f"line {e.lineno}, column {e.colno}: {e.msg}")
// C# with Newtonsoft.Json
try { JToken.Parse(text); Console.WriteLine("valid"); }
catch (JsonReaderException e) { Console.WriteLine($"line {e.LineNumber}, position {e.LinePosition}: {e.Message}"); } To check the structure as well as the syntax, write a JSON Schema and validate against it: ajv in JavaScript, the jsonschema package in Python, or Newtonsoft.Json.Schema in .NET. Run this validator first: a schema check can't start until the JSON parses.
A tool that checks whether text is valid JSON and, if not, shows where and why it fails, so you can fix it before an app or API rejects it.
Paste it above and press Validate. In code, parse it (json.loads in Python, JSON.parse in JavaScript): if parsing throws an error, the JSON is invalid.
Run it through the JSON formatter. It indents the JSON and puts every key on its own line.
Notepad++ has no JSON check of its own. Install a plugin such as JSON Viewer from Plugins > Plugins Admin and use its Format JSON command: invalid JSON won't format. For the exact line, column and fix, paste the text here.
It tells you what to change and highlights the spot, but doesn't rewrite your JSON by itself, so nothing changes without you seeing it.
It's free, with nothing to download, and the check runs in your browser.
Format JSON online: beautify messy JSON with 2 or 4 spaces or tabs, sort keys, minify it to one line and find errors. Free, runs in your browser.
Paste JSON and get Kotlin data classes for Android, with kotlinx.serialization, Gson or Moshi names, nullable fields and defaults. Free, in your browser.
Convert JSON to null-safe Dart model classes for Flutter, with fromJson, toJson and an optional copyWith. Free, no sign-up, runs in your browser.
Turn JSON into Swift Codable structs or classes, with CodingKeys for snake_case keys. Free JSON to Swift converter for iOS and macOS apps.