JsonYamlDiff is a simple and efficient command-line tool designed to compare JSON and YAML files, highlighting differences in both structure and content. It provides an easy way to spot changes between configuration files or data sets, making it an essential utility for developers and system administrators.
- Supports JSON and YAML formats: Easily compare JSON and YAML files side-by-side.
- Detailed comparison: Identifies and displays differences in file structure, values, and types.
- Command-line interface: Simple CLI commands for quick comparisons.
- Cross-platform: Works on any system that supports Node.js.
To use this tool, you'll need Node.js installed on your machine. Then, install the package globally.
# Clone the repository
$ git clone git@github.com:VladimirMastepanov/JsonYamlDiff.git
# Navigate to the project directory
$ cd JsonYamlDiff
# Install dependencies
$ make install-deps
To compare two files, run the gendiff command:
$ gendiff <file1> <file2>
For example:
$ gendiff file1.yml file2.yml
-V, --version output the version number
-f, --format <type> output format
-h, --help display help for command
- Commander – A popular tool for building CLI applications.
- js-yaml – For parsing and handling YAML files.
- lodash – Used for deep object comparison.
- Jest – For unit testing.
- ESLint (Airbnb config) – For code style enforcement and linting.
- Jest – For writing unit tests to ensure the reliability of the tool.
More examples of the application in action, showcasing output in various formatting options:
$ gendiff <filepath1> <filepath2>
$ gendiff -f plain <filepath1> <filepath2>
$ gendiff -f json <filepath1> <filepath2>