Package.json Validator
Validate and analyze package.json files with best practice recommendations.
What is the Package.json Validator?
The Package.json Validator is a free tool that checks a package.json file for structural problems and npm best-practice issues. Paste your file, run the validation, and get a clear list of errors, warnings, and a summary of the package.
It confirms the JSON parses, requires the name and version fields, checks that the version follows semver, and flags name problems such as uppercase letters, spaces, or names longer than 214 characters. It also warns about missing description, license, and repository fields and missing start or test scripts.
Validation happens entirely in your browser. There is no signup and your file is never uploaded, so you can safely check a private project's package.json.
How to use the Package.json Validator
- 1Paste the contents of your package.json into the text area, or edit the sample file already loaded.
- 2Click Validate to parse and analyze the file.
- 3Check the status banner to see whether the file is valid or invalid.
- 4Review the Errors section for problems that must be fixed, such as invalid JSON or a missing name.
- 5Review the Warnings section for recommended improvements like adding a license or repository field.
- 6Use the Package Information panel to confirm the detected name, version, and counts of dependencies and scripts.
What you can use it for
- Catching a syntax error in package.json before an npm install or build fails.
- Verifying a new package meets npm publishing requirements for name and version.
- Reviewing an open-source repository for missing description, license, or repository metadata.
- Confirming a generated or hand-edited package.json is well-formed before committing it.
- Quickly counting how many dependencies, devDependencies, and scripts a project declares.
Key features
- Reports the JSON parse error message when the file is malformed.
- Validates required name and version fields and checks semver formatting.
- Enforces npm name rules: lowercase, no spaces, and a 214-character limit.
- Warns about missing description, license, repository, and common start and test scripts.
- Summarizes the package name, version, and dependency, devDependency, and script counts.
Frequently asked questions
What does the package.json validator check?
It confirms the file is valid JSON, requires the name and version fields, and verifies the version uses semver format. It also enforces npm name rules and warns when recommended fields like description, license, and repository, or the start and test scripts, are missing.
What are the required fields in a package.json file?
For npm, name and version are the two required fields, and this validator reports an error if either is missing. Fields such as description, license, and repository are recommended rather than required, so missing them produces warnings instead of errors.
Why is my package.json showing as invalid?
A file is marked invalid when it fails JSON parsing or when a required-field error is found. Common causes include a trailing comma, an unquoted key, a missing brace, or an absent name or version field. The Errors section names the specific problem.
What are the npm rules for a valid package name?
An npm package name must be lowercase, must not contain spaces, and must be 214 characters or fewer. The validator flags uppercase letters as a warning and treats spaces and over-length names as errors.
Is the package.json validator safe for private projects?
Yes. The tool runs entirely in your browser and never uploads your file, so pasting a private project's package.json does not send it anywhere. No account or signup is required.
Does the validator check that my dependency versions exist on npm?
No. It checks the structure of the file, the required fields, the name rules, and the version format, and it counts dependencies, but it does not contact the npm registry or verify that each listed package or version is real.