package.json Validator

Paste a package.json file to check that it is valid JSON and that the name, version and dependency fields follow the npm rules. It lists any errors and common warnings.

1 Paste or type your text

2 Your answer

Your answer shows here as you type.

How to use the package.json Validator

  1. Paste the contents of your package.json file into the box.
  2. Read the Result row first, then check the Errors and Warnings rows.
  3. Fix the listed problems in your file and paste it again to recheck.

Frequently asked questions

What does npm require in a package.json file?

npm needs a file that is valid JSON with an object at the top level. A publishable package also needs a name and a version. The name must be lowercase, 214 characters or fewer, and URL-safe, and the version should follow semver as major.minor.patch, such as 1.2.3.

What characters are allowed in an npm package name?

Names use lowercase letters, digits, hyphens, dots, underscores and tildes. A scoped name has the form @scope/name, where the scope and name follow the same rules. Names cannot start with a dot or an underscore.

Does this validator check whether the package name is free on npm?

No. It checks the format and the common rules only. It does not contact the npm registry, so it cannot tell whether a name is already taken.

Wrote something with AI? Slop Monkey rewrites it so it sounds like you, and keeps your facts.