Skip to content
FR
  1. LuzineDebug
  2. Tools
  3. JSON validator

JSON validator: find the exact line of the error

Validate, format and minify JSON, with the exact line and column of the error. Everything happens in your browser.

The most common JSON errors

  • Trailing comma: [1, 2, 3,] or {"a": 1,} — remove the last comma.
  • Single quotes: {'a': 1} — JSON only accepts double quotes.
  • Unquoted key: {a: 1} must be written {"a": 1}.
  • Comments // or /* */: not allowed in JSON (allowed in JSONC, like tsconfig.json).
  • HTML instead of JSON: a < at position 0 means the response is an HTML page.

Frequently asked questions

Why is my JSON invalid when it works in JavaScript?

JSON is stricter than a JavaScript object: keys in double quotes, no single quotes, no comma after the last item, no comments, no undefined or NaN.

What does "Unexpected token < in JSON at position 0" mean?

You are parsing HTML as JSON: the server returned an error page (404, 500, login page) instead of the expected response.

Is my data sent anywhere?

No, validation uses your browser’s own JSON engine.

Errors this tool helps solve

TypeError: Cannot read properties of undefined (reading 'map')

Fix "Cannot read properties of undefined" in JavaScript

You are reading a property (here map) on a value that is undefined or null. The object before the dot does not exist yet or does n…

JavaScript & Node.js Beginner 10 min
SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON

Fix "Unexpected token '<', "<!DOCTYPE "... is not valid JSON"

Your code calls response.json() or JSON.parse(), but the server returned an HTML page (starting with <!DOCTYPE) instead of JSON. I…

JavaScript & Node.js Beginner 10 min
Error: Cannot find module 'express'

Fix "Error: Cannot find module" in Node.js

Node.js cannot find the imported package or file. For a package ('express'), install it with npm install in the folder that contai…

JavaScript & Node.js Beginner 10 min
npm ERR! ERESOLVE unable to resolve dependency tree

Fix "npm ERR! ERESOLVE unable to resolve dependency tree"

npm refuses to install because two packages require incompatible versions of the same dependency, most often a peer dependency (Re…

JavaScript & Node.js Intermediate 15 min
SyntaxError: Cannot use import statement outside a module

Fix "SyntaxError: Cannot use import statement outside a module"

A file uses the ES modules import syntax while it is loaded as a classic script or as CommonJS. In Node.js, add "type": "module" t…

JavaScript & Node.js Intermediate 15 min
Your requirements could not be resolved to an installable set of packages.

Fix "Your requirements could not be resolved to an installable set of packages" (Composer)

Composer cannot find any combination of versions that meets every constraint: PHP version too old, missing ext-* extension, or two…

PHP & Laravel Intermediate 15 min
Vite manifest not found at: /var/www/public/build/manifest.json

Fix "Vite manifest not found at: public/build/manifest.json" in Laravel

Laravel’s @vite directive finds neither the Vite dev server nor the built files. Locally, run npm install then npm run dev; for pr…

PHP & Laravel Beginner 5 min
TypeError: 'NoneType' object is not subscriptable

Fix "'NoneType' object is not subscriptable" in Python

You are using [...] on a variable that is None. Most often a function has no return, or a method like list.sort() that returns Non…

Python Beginner 10 min

Other tools