A customizable JSON formatter that serializes JavaScript values to formatted JSON strings with support for key sorting, custom replacers, and indentation control. Current version 0.0.1 is very early and not actively maintained; last release in 2016. Differentiates from JSON.stringify by default sorting keys alphabetically and providing a global defaults override through `json.defaults`. Minimal API with three options: replacer, sortKeys (default true), and spaces. Suitable for pretty-printing with consistent key order but lacks active development or recent updates.
npm install json-stringNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates default sorted output, disabling key sorting, and using a custom replacer to modify values.
Consider using JSON.stringify with sorting implemented manually or use a maintained alternative like 'json-stable-stringify'.
Use import json from 'json-string' in modern JS or transpile with bundler.
Explicitly pass { sortKeys: false } if you want to keep insertion order.Use per-call options instead of modifying defaults, or clone defaults before modification.
Use import json from 'json-string' or const json = require('json-string').default if using require and the package is transpiled.Run `npm install json-string` and ensure package.json contains it.
Call the default export directly: json(obj) or json(obj, options).
No dependency data recorded yet.