Registry / serialization / json-bundler

json-bundler

JSON →
library1.0.0jsnpmunverified

json-bundler is a Node.js CLI tool for bundling multiple JSON and JSON5 files into a single merged JSON file. Version 1.0.0 is the initial release. It uses a $ref key to reference other JSON files, supports JSON5 for comments and linebreaks, and offers minification and watch mode. Features include merging with priority for the referencing file and support for referencing npm packages via ~. It is designed for tasks like i18n file organization in Angular or other web projects. Requires Node.js 7.6+.

npm install json-bundler
INSTALL
IMPORT
SIG · JSON-BUNDLER
J
json-bundler
serializationjavascriptv1.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Install json-bundler, create entry and referenced JSON files, then bundle them into a single output file.

npm install json-bundler --save-dev # Create entry file: en.json { "greeting": "Hello", "$ref": "./messages/welcome.json" } # Referenced file: messages/welcome.json { "welcome": "Welcome to our app!" } # Run bundler (outputs merged file) npx json-bundler --entryFile en.json --outFile dist/en.json
json-bundler --version
Debug
Known issues
gotcha`$ref` paths are relative to the file containing the $ref, not the current working directory.
fix
Use paths relative to the file's location.
affects: 1.0.0
gotchaWhen a referenced file contains keys that already exist in the referencing file, the referencing file's values take precedence.
fix
Be aware of merge priority: referencing file overrides referenced files.
affects: 1.0.0
gotchaPaths starting with `~` are resolved in the project's `node_modules` folder, not user home directory.
fix
Use `~package-name/path/file.json` to reference npm packages.
affects: 1.0.0
Errors
Common errors & fixes
ENOENT: no such file or directory, open './nonexistent.json'
Referenced file path is incorrect or file missing.
fix
Ensure referenced file exists and the path in $ref is correct relative to the referencing file.
Error: Invalid JSON5 file
Referenced JSON5 file has syntax errors.
fix
Validate JSON5 syntax with a JSON5 parser or use valid JSON.
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies
json5requiredParsing JSON5 files
chokidaroptionalWatch mode file monitoring
Agent activity
4 hits · last 30 days
node
4
Resources
json-bundler — npm install json-bundler · libregistry