JSON Validator

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.

How to use the JSON Validator

  1. Paste your JSON into the box.
  2. Press Validate and read the result: valid, or the line and column of the first error with a hint.
  3. Fix the error and validate again until it says valid. Format it with the JSON formatter if you want it readable.

About this tool

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.

What a JSON validator checks

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.

The mistakes that break JSON most often

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"] }

Validate JSON in Python and C#

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}"); }

Validating with a schema

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.

Frequently asked questions

What is a JSON validator?

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.

How do I check if my JSON is valid?

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.

How do I make a JSON file readable?

Run it through the JSON formatter. It indents the JSON and puts every key on its own line.

How do I validate JSON in Notepad++?

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.

Can it fix my JSON?

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.

Is it free, and is my JSON uploaded?

It's free, with nothing to download, and the check runs in your browser.

More json tools

JSON and code models

All 31 free tools →
JSON tool · Runs in your browser

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.

Free · No sign-upOpen tool
JSON tool · Runs in your browser

JSON to Kotlin Data Class

Paste JSON and get Kotlin data classes for Android, with kotlinx.serialization, Gson or Moshi names, nullable fields and defaults. Free, in your browser.

Free · No sign-upOpen tool
JSON tool · Runs in your browser

JSON to Dart (Flutter)

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.

Free · No sign-upOpen tool
JSON tool · Runs in your browser

JSON to Swift (Codable)

Turn JSON into Swift Codable structs or classes, with CodingKeys for snake_case keys. Free JSON to Swift converter for iOS and macOS apps.

Free · No sign-upOpen tool