The `merge-json-cli` package (current stable version 1.0.4) is a lean command-line utility designed for merging multiple JSON files into a single output. It introduces a custom "spread syntax" (`"..."`) directly within JSON objects and arrays, allowing developers to declaratively reference external JSON files or specific paths within them using JSON pointers. This enables dynamic composition of complex configurations from modular JSON fragments. The tool supports both object and array merging, including the use of glob patterns for array-based merges. As a CLI tool, its release cadence is driven by feature enhancements and bug fixes rather than a fixed schedule. Its primary differentiator is the in-JSON spread syntax, providing an intuitive way to manage hierarchical data structures across multiple files. It requires Node.js version 18.3.0 or higher.
npm install merge-json-cliNo compatibility data collected yet for this library.
Demonstrates how to run the `merge-json-cli` tool directly using `npx` to merge an input JSON file that references another JSON file via its custom spread syntax, outputting the consolidated result.
Ensure your Node.js environment is updated to version 18.3.0 or newer before running the CLI tool.
Verify that all paths used with `"..."` correctly point to existing JSON files or valid nested keys within those files (e.g., `./my-data.json` or `./config.json#/app/settings`).
Double-check the existence and permissions of all JSON files referenced within your configurations. Use absolute paths if relative paths cause ambiguity.
Always use `--in <file>` or `-i <file>` for the source JSON, and `--out <file>` or `-o <file>` for the target output file.
Correct the file path specified in the `"..."` value within your JSON configuration, or ensure the referenced file is present at that location.
Validate all your input JSON files for correct JSON syntax using a linter or an online JSON validator to fix any parsing errors.
Update your Node.js installation to version 18.3.0 or newer using a Node.js version manager like `nvm` or by downloading the latest LTS release from the official Node.js website.