Registry / devops / fracturedjsonjs

fracturedjsonjs

JSON →
library5.0.1jsnpmunverified

FracturedJsonJs v5.0.1 is a JSON formatter for Node.js and browsers that produces highly readable yet compact output by placing arrays/objects on single lines when possible, aligning similar structures into tables, and packing long arrays with multiple items per line. It supports JSON-with-comments (JSONC) and includes TypeScript types. Active development with regular releases; key differentiator is compact table-like alignment vs. standard pretty-printers.

npm install fracturedjsonjs
INSTALL
IMPORT
SIG · FRACTUREDJSONJS
F
fracturedjsonjs
devopsjavascriptv5.0.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Formatter
import { Formatter } from 'fracturedjsonjs'
const { Formatter } = require('fracturedjsonjs')
Package is ESM-only; CommonJS require is not supported.
FracturedJsonOptions
import { FracturedJsonOptions } from 'fracturedjsonjs'
import FracturedJsonOptions from 'fracturedjsonjs'
Default export is not available; use named import.
CommentPolicy
import { CommentPolicy } from 'fracturedjsonjs'
Enum for comment handling (Preserve, Remove, etc.).

Shows basic usage: create options, instantiate formatter, set options, and reformat a JSON string.

import { Formatter, FracturedJsonOptions } from 'fracturedjsonjs'; const options = new FracturedJsonOptions(); // Customize options as needed options.MaxTotalLineLength = 100; const formatter = new Formatter(); formatter.Options = options; const input = { "name": "Example", "values": [1, 2, 3, 4, 5] }; const jsonString = JSON.stringify(input); const formatted = formatter.Reformat(jsonString); console.log(formatted);
Debug
Known issues
gotchaFormatter.Reformat() expects a JSON string, not a JavaScript object. Passing an object may cause unexpected stringification or errors.
fix
Call JSON.stringify(yourObject) before passing to Reformat() if you have a JavaScript object.
affects: >=1.0.0
gotchaFracturedJsonOptions is mutable after being passed to Formatter. Changing an option after setting it on the formatter may have no effect or produce inconsistent behavior.
fix
Set all desired options on the options instance before assigning it to Formatter.Options, or create a new options instance per format call.
affects: >=1.0.0
breakingIn v5, the default constructor FracturedJsonOptions() creates options that maintain backward compatibility across minor versions. To get the latest optimal settings, use FracturedJsonOptions.Recommended() instead.
fix
Use new FracturedJsonOptions() for stability, or FracturedJsonOptions.Recommended() for newest defaults (may change in minor updates).
affects: >=5.0.0
Errors
Common errors & fixes
Cannot find module 'fracturedjsonjs'
Package not installed or incorrect import path.
fix
Run 'npm i fracturedjsonjs' and ensure you are using an ES module (type: module in package.json or .mjs extension).
FracturedJsonOptions is not a constructor
Using CommonJS require() instead of ESM import.
fix
Change 'const { FracturedJsonOptions } = require("fracturedjsonjs")' to 'import { FracturedJsonOptions } from "fracturedjsonjs"'. The package is ESM-only.
TypeError: formatter.Reformat is not a function
Formatter instance not properly created; possibly using class incorrectly.
fix
Ensure you use 'new Formatter()' and that the import is correct: 'import { Formatter } from "fracturedjsonjs"'.
Upgrade
Version history
5.0.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
fracturedjsonjs — npm install fracturedjsonjs · libregistry