$devtoolkit.sh/examples/json/package-json

Validate a package.json File

A malformed package.json stops npm and yarn in their tracks with cryptic parse errors. This example shows a realistic package.json with scripts, dependencies, and devDependencies. Paste your own file to verify syntax before committing or running installs. The validator pinpoints the exact line and column of any error.

Example
{
  "name": "my-app",
  "version": "1.0.0",
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "lint": "eslint ."
  },
  "dependencies": {
    "next": "14.2.0",
    "react": "18.3.0"
  },
  "devDependencies": {
    "typescript": "5.4.0"
  }
}
[ open in JSON Validator → ]

FAQ

What breaks package.json syntax?
The most common mistakes are trailing commas after the last property, single-quoted strings instead of double quotes, and missing commas between entries.
Does this validate npm field requirements?
This tool validates JSON syntax. For npm-specific field validation (required name, valid semver versions) you still need to run npm itself.
Can I use this for yarn or pnpm?
Yes. yarn and pnpm both use package.json with the same JSON syntax, so this validator works for all three package managers.

Related Examples

/examples/json/package-jsonv1.0.0