π¦ package.json Validator
π Input package.json
What Can the package.json Validator Do?
The package.json Validator is a free online tool for checking whether a Node.js project's package.json file conforms to specifications. It supports required field checks, version format validation, dependency conflict detection, and script syntax checking, helping developers ensure their package.json configuration is correct.
Core Features
- Field Completeness: Validates required fields (name, version) and checks recommended fields (description, keywords, license)
- Version Format Validation: Checks all dependency versions against semver specification
- Dependency Conflict Detection: Checks for duplicate declarations and version conflicts
- Script Syntax Check: Validates scripts field command format
- Auto Fix: One-click fix for missing fields and field ordering
- File Import: Drag and drop package.json files for direct validation
How to Use
1. Paste package.json content in the input box, or drag and drop a file
2. Click "Validate" to see check results
3. Errors (red) must be fixed, warnings (yellow) should be fixed, passed (green) is OK
4. Click "Auto Fix" to fix common issues
5. Use "Download Fixed" to save the corrected package.json
6. Keyboard shortcut: Ctrl+Enter to validate quickly
Use Cases
Case 1: Pre-Publish Check
Before publishing an NPM package, ensure package.json is complete and valid using this tool.
Case 2: Project Initialization
Verify package.json configuration after creating a new project to avoid installation and build issues.
Case 3: Dependency Upgrade Review
Check version formats and dependency conflicts after upgrading dependencies.
Case 4: Code Review
Quickly validate package.json changes in pull requests.
Technical Background
package.json is the core configuration file for Node.js projects. npm v7+ supports workspaces, overrides, and other new fields. Only name and version are required, but adding description, keywords, license, and repository is recommended for better package discoverability. Version numbers follow semver (major.minor.patch), and dependency version ranges use ^, ~ prefixes. peerDependencies declare dependencies the host environment must provide.
β What does the validator check?
Required fields (name/version), recommended fields, version format (semver), dependency conflicts, scripts syntax, engines field.
β How are dependency conflicts detected?
Checks for packages in both dependencies and devDependencies, and whether peerDependencies are properly declared.
β Does this tool upload my data?
No. All validation is done locally in the browser. No data is sent to any server.
β Which package.json versions are supported?
Supports npm v7+ format including workspaces, overrides, peerDependenciesMeta.
β Can I fix found issues?
Yes. Some issues can be auto-fixed (missing fields, field sorting). Download the fixed version.
β Can I import from a file?
Yes. Drag and drop a package.json file into the input area.