https://github.com/SlimIO/json-diff
Stdout difference from two JS Objects in the TTY
https://github.com/SlimIO/json-diff
Last synced: 8 months ago
JSON representation
Stdout difference from two JS Objects in the TTY
- Host: GitHub
- URL: https://github.com/SlimIO/json-diff
- Owner: SlimIO
- License: mit
- Created: 2019-09-12T07:20:39.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T02:16:00.000Z (about 3 years ago)
- Last Synced: 2025-04-29T11:42:35.825Z (9 months ago)
- Language: JavaScript
- Homepage:
- Size: 382 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 23
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
- awesome-crafted-nodejs - @slimio/json-diff - Stdout difference from two JS Objects in the TTY (Packages / CLI (TTY etc..))
README
# Json-diff

[](https://github.com/SlimIO/json-diff/commit-activity)




[](https://travis-ci.com/SlimIO/json-diff)
Differentiates JSON in you terminal with color.
## Requirements
- [Node.js](https://nodejs.org/en/) v12 or higher
## Getting Started
This package is available in the Node Package Repository and can be easily installed with [npm](https://docs.npmjs.com/getting-started/what-is-npm) or [yarn](https://yarnpkg.com).
```bash
$ npm i @slimio/json-diff
# or
$ yarn add @slimio/json-diff
```
## Usage example
```js
const jsonDiff = require("@slimio/json-diff");
const json1 = {
number: 10,
array: ["x", "y", "z"]
}
const json2 = {
number: 20,
array: ["x", "y", "w"]
}
jsonDiff(json1, json2);
```
It will produce the following stdout:

## API
### jsonDiff(original: object, diff: object, options?: Options): void
Stdout the difference between two JSON Object. Available options is described by the following TypeScript interface
```ts
interface Options {
color?: boolean;
}
```
## Dependencies
|Name|Refactoring|Security Risk|Usage|
|---|---|---|---|
|[kleur](https://github.com/lukeed/kleur)|Minor|Low|TTY color|
## License
MIT