---
title: "JSON Validator Online: Check & Fix JSON Syntax | Prettify"
description: Validate JSON online and get a clear valid or invalid verdict, with
  the line and column of the first error. Strict JSON check in your browser.
  Free, no upload.
url: https://prettify.tools/json-validator
---

# JSON Validator

Paste JSON and get a verdict: valid, or invalid with the line and column of the first error. The validator checks strict JSON, the form that every standard parser accepts, and it flags duplicate keys as warnings. It runs in your browser, so you can recheck after each fix.

## What the JSON validator checks

A validator answers one question: will a strict JSON parser accept this text? Paste a JSON object or array. The result panel shows a green verdict with the shape of the data, or a red error with its position.

The check is strict on purpose. JavaScript-style comments, trailing commas, and single quotes make a document invalid, because strict parsers such as JSON.parse reject them. That is the right test before you send a payload to an API or commit a file that a build tool will read.

## Key features

The verdict is short, but it carries enough detail to act on. Each result tells you what the parser decided and where it decided it. The details below are what you can expect to see in the result panel.

- A valid document shows Valid JSON and its size, such as Object with 4 keys, 1 level deep.
- An error shows Line and column, and a plain message such as Expected comma (,) or closing bracket or Unterminated string.
- Relaxed JSON is named. If the text is valid JSONC, the error says which relaxation it uses, such as comments or trailing commas.
- Duplicate keys are valid, so they appear as a warning. The message names the key and both values.
- Several documents pasted together get a hint that the text looks like NDJSON, with the advice to wrap them in an array.
- The box reports the first error. The editor lists every problem in the Problems panel, and each entry jumps to its line.

## How to validate JSON

The box at the top of this page gives the verdict. It runs in your browser and takes documents up to 512 KB. Larger documents go straight to the editor.

1. Paste your JSON into the box at the top of this page, or select Try an example.
2. Read the verdict. A green line means the text is strict JSON.
3. If you see an error, note the line and column, and read the message.
4. Select Fix it in the editor. The paste dialog opens with your text, the first error, and a list of the problems it finds.
5. Correct the text, or select Fix all for the mistakes it can repair. Then select Format in the dialog.
6. In the editor, open the Raw tab, select Edit, and watch the live check. It shows Valid JSON when the text parses.

## Worked example: check a webhook payload

Say a billing webhook arrives with a missing comma after the status line. The first sample below is the input. The result is an error at line 5, column 3.

The error points at the key total, not at the status line. The parser only notices the problem when it meets a key where it expects a comma. Add the comma after "paid" and the same text gives a green verdict. The third sample shows a duplicate key: the text is valid, so you get a warning and not an error.

```
Input
{
  "event": "invoice.paid",
  "id": 101,
  "status": "paid"
  "total": 42.5
}

Result
Line 5, column 3: Expected comma (,) or closing bracket

After adding the comma
Valid JSON. Object with 4 keys, 1 level deep.

After adding the line "id": 102 below total
Valid JSON. Object with 4 keys, 1 level deep.
Line 6: Duplicate key "id": value 101 was overwritten by 102. Remove one to fix.
```

## Common use cases

Validation is the quickest way to find out why a parser refuses a document. It also gives you a clear yes or no before you send or commit a file. These are the usual jobs.

- Find out why JSON.parse throws an Unexpected token error.
- Check an API request body before you send it.
- Confirm that a config file is strict JSON before a build reads it.
- Catch duplicate keys in a file that a script generated.
- Check that the output of a script that prints JSON is one complete document.

## Valid is not the same as correct

A valid document can still hold the wrong data: a number where a string belongs, or a missing required field. Checking that needs a JSON Schema. Schema validation is a Pro feature. This page checks syntax only.

## Frequently asked questions

### Why does my tsconfig.json or JavaScript object fail here?

Those formats allow comments, trailing commas, or single quotes, and strict JSON does not. The error names the first one it finds and tells you the text is valid JSONC. Remove those parts, or run the text through the JSON formatter, which writes strict JSON.

### Are duplicate keys invalid JSON?

Not for the parser. JSON.parse keeps the last value, so the document is valid. Prettify still warns you, because a duplicate key usually means a bug in the code that wrote the file.

### Why does the error point to the line after my mistake?

A parser reports where it noticed the problem, not where you made it. With a missing comma, that is the start of the next item. Look at the end of the line above the reported position.

### Can the validator check a JSON Schema?

Yes, in the editor, with Pro. Open JSON Schema in the toolbar, under the Check group. The box on this page checks syntax only.

### Is my webhook payload uploaded to be checked?

No. The parser runs in your browser tab, so tokens and customer fields in a payload stay on your device. The page sends none of your text anywhere.

## Related tools

- [JSON Formatter: Prettify and Pretty Print JSON](https://prettify.tools/json-formatter)
- [JSON Syntax Checker](https://prettify.tools/json-syntax-checker)
- [JSON Viewer with Tree, Table, and Diagram Views](https://prettify.tools/json-viewer)
- [YAML Validator and Linter](https://prettify.tools/yaml-validator)
- [JSON Editor Online](https://prettify.tools/json-editor)
- [JSON Schema Validator](https://prettify.tools/json-schema-validator)

## Structured data

```json
{
  "@context": "https://schema.org",
  "@type": "SoftwareApplication",
  "name": "Prettify",
  "url": "https://prettify.tools",
  "description": "Multi-format data viewer, editor, and query engine for JSON, YAML, CSV, XML, Mermaid, Markdown, MDX, HTML, and SVG",
  "applicationCategory": "DeveloperApplication",
  "operatingSystem": "Web, macOS, Windows, Linux",
  "offers": [
    {
      "@type": "Offer",
      "price": "0",
      "priceCurrency": "USD",
      "description": "Free tier with core features"
    },
    {
      "@type": "Offer",
      "price": "19.99",
      "priceCurrency": "USD",
      "description": "Pro: lifetime access to all features"
    }
  ],
  "publisher": {
    "@id": "https://prettify.tools/#organization"
  }
}
{
  "@context": "https://schema.org",
  "@type": "Organization",
  "@id": "https://prettify.tools/#organization",
  "name": "Prettify",
  "legalName": "Off Leash Labs",
  "url": "https://prettify.tools/",
  "logo": {
    "@type": "ImageObject",
    "url": "https://prettify.tools/icon-512.png",
    "width": 512,
    "height": 512
  },
  "contactPoint": {
    "@type": "ContactPoint",
    "contactType": "customer support",
    "email": "offleashlabs@gmail.com",
    "availableLanguage": "English"
  }
}
{
  "@context": "https://schema.org",
  "@graph": [
    {
      "@type": "WebPage",
      "@id": "https://prettify.tools/json-validator",
      "url": "https://prettify.tools/json-validator",
      "name": "JSON Validator Online: Check & Fix JSON Syntax | Prettify",
      "description": "Validate JSON online and get a clear valid or invalid verdict, with the line and column of the first error. Strict JSON check in your browser. Free, no upload.",
      "isPartOf": {
        "@type": "WebSite",
        "name": "Prettify",
        "url": "https://prettify.tools"
      }
    },
    {
      "@type": "FAQPage",
      "mainEntity": [
        {
          "@type": "Question",
          "name": "Why does my tsconfig.json or JavaScript object fail here?",
          "acceptedAnswer": {
            "@type": "Answer",
            "text": "Those formats allow comments, trailing commas, or single quotes, and strict JSON does not. The error names the first one it finds and tells you the text is valid JSONC. Remove those parts, or run the text through the JSON formatter, which writes strict JSON."
          }
        },
        {
          "@type": "Question",
          "name": "Are duplicate keys invalid JSON?",
          "acceptedAnswer": {
            "@type": "Answer",
            "text": "Not for the parser. JSON.parse keeps the last value, so the document is valid. Prettify still warns you, because a duplicate key usually means a bug in the code that wrote the file."
          }
        },
        {
          "@type": "Question",
          "name": "Why does the error point to the line after my mistake?",
          "acceptedAnswer": {
            "@type": "Answer",
            "text": "A parser reports where it noticed the problem, not where you made it. With a missing comma, that is the start of the next item. Look at the end of the line above the reported position."
          }
        },
        {
          "@type": "Question",
          "name": "Can the validator check a JSON Schema?",
          "acceptedAnswer": {
            "@type": "Answer",
            "text": "Yes, in the editor, with Pro. Open JSON Schema in the toolbar, under the Check group. The box on this page checks syntax only."
          }
        },
        {
          "@type": "Question",
          "name": "Is my webhook payload uploaded to be checked?",
          "acceptedAnswer": {
            "@type": "Answer",
            "text": "No. The parser runs in your browser tab, so tokens and customer fields in a payload stay on your device. The page sends none of your text anywhere."
          }
        }
      ]
    }
  ]
}
```
