Config parsers for:
✅ JSONC (with jsonc-parser
)
✅ JSON
With perfect bundling:
✨ Types exported out of the box
✨ Zero config and compact redistribution
✨ Dual ESM/CJS build
✨ Consistent and tested API
✨ Handpicked best libraries (bundle+perf)
✨ Auto detects indentation and whitespace when parsing and preservers when serializing
[!NOTE] Use unjs/c12 for a full featured configuration loader!
Install package:
# ✨ Auto-detect
npx nypm install confbox
# npm
npm install confbox
# yarn
yarn add confbox
# pnpm
pnpm install confbox
# bun
bun install confbox
Import:
ESM (Node.js, Bun)
import {
parseJSON5,
stringifyJSON5,
parseJSONC,
stringifyJSONC,
parseYAML,
stringifyYAML,
parseJSON,
stringifyJSON,
parseTOML,
stringifyTOML,
} from "confbox";
CommonJS (Legacy Node.js)
const {
parseJSON5,
stringifyJSON5,
parseJSONC,
stringifyJSONC,
parseYAML,
stringifyYAML,
parseJSON,
stringifyJSON,
parseTOML,
stringifyTOML,
} = require("confbox");
CDN (Deno, Bun and Browsers)
import {
parseJSON5,
stringifyJSON5,
parseJSONC,
stringifyJSONC,
parseYAML,
stringifyYAML,
parseJSON,
stringifyJSON,
parseTOML,
stringifyTOML,
} from "https://esm.sh/confbox";
Converts a JSON string into an object.
Indentation status is auto-detected and preserved when stringifying back using stringifyJSON
Converts a JSON5 string into an object.
Converts a JSONC string into an object.
Converts a TOML string into an object.
Converts a YAML string into an object.
Converts a JavaScript value to a JSON string.
Indentation status is auto detected and preserved when using value from parseJSON.
Converts a JavaScript value to a JSON5 string.
Converts a JavaScript value to a JSONC string.
Converts a JavaScript value to a TOML string.
Converts a JavaScript value to a YAML string.
Local development
Published under the MIT license.
Made by @pi0 and community 💛
🤖 auto updated with automd