Registry / devops / json-formatter-minifier

json-formatter-minifier

JSON →
library1.0.0jsnpmunverified

A lightweight utility for formatting and minifying JSON strings. Provides functions to convert JSON to a pretty-printed string or a compact, whitespace-free format. Simple API with no dependencies, suitable for Node.js and browser environments. Current version 1.0.0, low release cadence. Differentiates by minimal footprint and zero dependencies.

npm install json-formatter-minifier
INSTALL
IMPORT
SIG · JSON-FORMATTER-MIN
J
json-formatter-minifier
devopsjavascriptv1.0.0
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.

default
import jsonFormatterMinifier from 'json-formatter-minifier'
const jfm = require('json-formatter-minifier')
The package does not ship TypeScript types; use dynamic import or CJS require. Check your bundler.
formatJSON
import { formatJSON } from 'json-formatter-minifier'
const { formatJSON } = require('json-formatter-minifier')
Require may not work depending on export.
minifyJSON
import { minifyJSON } from 'json-formatter-minifier'
import minifyJSON from 'json-formatter-minifier'
Named export, not default.

Format and minify a JSON string with default import and named exports.

import { formatJSON, minifyJSON } from 'json-formatter-minifier'; const data = { name: 'Alice', age: 30, city: 'New York' }; const jsonStr = JSON.stringify(data); const formatted = formatJSON(jsonStr); console.log(formatted); // { // "name": "Alice", // "age": 30, // "city": "New York" // } const minified = minifyJSON(jsonStr); console.log(minified); // {"name":"Alice","age":30,"city":"New York"}
Debug
Known issues
gotchaMay throw for invalid JSON strings.
fix
Wrap calls in try-catch or validate JSON via JSON.parse first.
affects: all
gotchaNo TypeScript declarations, might cause build errors in strict TS projects.
fix
Add declare module 'json-formatter-minifier' in a .d.ts file or use @ts-ignore.
affects: all
gotchaBrowser usage may require bundler to convert CommonJS to ESM.
fix
Use import or configure bundler (e.g., Webpack module: { rules: ... }).
affects: all
Errors
Common errors & fixes
Cannot find module 'json-formatter-minifier'
Package not installed or import path incorrect.
fix
npm install json-formatter-minifier
TypeError: jsonFormatterMinifier is not a function
Used default import on a named export or vice versa.
fix
Check documentation: use named imports { formatJSON, minifyJSON }.
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
7 hits · last 30 days
node
6
Resources
json-formatter-minifier — npm install json-formatter-minifier · libregistry