A zero-dependency JSON string formatter that prettifies JSON strings without parsing them into objects, avoiding the overhead and potential errors of JSON.parse. Version 1.0.1 is the latest stable release; the project appears to be in early maintenance. Unlike typical formatters that rely on JSON.parse/stringify, this library works directly on the string, preserving non-standard JSON syntax like single quotes or trailing commas.
npm install json-string-formatterNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates basic formatting and custom indent/linebreak options using ES module import.
Validate input with JSON.parse before formatting if standard JSON is required.
Use double quotes for valid JSON; this library is intended for non-standard or relaxed JSON strings.
Use `const { format } = require('json-string-formatter')` or `import { format } from 'json-string-formatter'`.Use named import: `import { format } from 'json-string-formatter'` or access property: `const { format } = require('json-string-formatter')`.Replace single quotes with double quotes for standard JSON; this library is lenient but JSON.parse will fail.
Ensure input is a string before calling format().
No dependency data recorded yet.