Skip to main content
Developer helpers100% FreeInstant

package.json Validator and Sorter

This free tool checks a package.json file for mistakes that stop npm from publishing or installing it. It checks the name and version rules, flags risky dependency versions and duplicates, and sorts the keys in the usual npm order.

By Debmedia Technologies LLP · Kolkata, India · Updated

What Is It and When Do You Need It?

A small mistake in package.json can stop an install or a publish. A check before you commit saves a failed build.

Paste the file and read the report.

How to Use This Tool

  1. Enter or paste your input in the box or boxes above.
  2. Choose the options, if there are any.
  3. Press the button to run the tool.
  4. Read the result and use the copy button where one is shown.

How the Calculation Works

The JSON is parsed first, and any syntax error is shown with its position. The tool then checks the name and version, looks for missing fields such as license and description, checks that scripts are text, looks at each dependency range, and finds names that appear in more than one dependency list. For sorting it uses the well-known key order and sorts the dependency maps.

Worked Example

A dependency set to "*" is flagged as risky. A name with capital letters, like MyApp, is flagged as invalid.

Common Uses

  • Before publishing to npm.
  • Reviewing pull requests.
  • Keeping files tidy.
  • Teaching npm.

Tips and Common Mistakes

  • Private packages do not need a license.
  • Use lock files to fix exact versions.
  • The check is advice, not a replacement for npm itself.
  • Check the first result against a case you already know, so you can trust the tool for the rest.
  • Nothing you type leaves your device. The work is done by your browser, so it also works with a slow connection once the page has loaded.

Next, you may need the semver comparator, .npmrc validator, JSON formatter and validator, CSV and JSON converter.

Everything runs in your browser. Nothing you type is uploaded, stored or sent to any outside service.

Frequently Asked Questions

Lowercase, 214 characters or fewer, no spaces, not starting with a dot or underscore, and only URL-safe characters. Scoped names look like @scope/name.
A semantic version such as 1.2.3, with optional pre-release and build parts, like 1.0.0-beta.1.
It lets any version install, including breaking ones. Pin a range such as ^1.2.0 instead.
It puts keys in the common order: name, version, description, scripts, dependencies, and so on, and sorts dependency names alphabetically. It does not change any values.

Disclaimer: results are calculated in your browser from the numbers you enter. Check important results before you rely on them for money, health, safety or legal decisions.