Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jclulow/jsondiff
A simple command-line JSON diff utility
https://github.com/jclulow/jsondiff
Last synced: 25 days ago
JSON representation
A simple command-line JSON diff utility
- Host: GitHub
- URL: https://github.com/jclulow/jsondiff
- Owner: jclulow
- Created: 2012-02-18T02:26:51.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2013-01-23T19:22:02.000Z (almost 12 years ago)
- Last Synced: 2024-08-29T18:37:35.269Z (4 months ago)
- Language: JavaScript
- Homepage:
- Size: 169 KB
- Stars: 63
- Watchers: 4
- Forks: 14
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# jsondiff
This is a first cut of a simple JSON diff utility, inspired by the usefulness
and simplicity of [trentm/json](https://github.com/trentm/json).## Usage
Install node.js, then simply call the script on two JSON files, like so:
```bash
jsondiff left.json right.json
```## License
ISC. See the header in the source.
## Examples
### Array Diff
Left:
```json
[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]
```Right:
```json
[1,2,6,7,8,9,10,11,12,13,14,15,16,17,18,5,5,5,19,20]
```Diff:
```diff
[
1,
2,
- 3,
- 4,
- 5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
+ 5,
+ 5,
+ 5,
19,
20
]
```### Object Diff
Left:
```json
{
"c": 6,
"aa": 7,
"y": "diff all the things!",
"z": true,
"removed": {
"red": true,
"green": false,
"blue": false
},
"common": {
"john": 4,
"still here": true
},
"equal": "!!!!",
"wasarray": [ 1, 2 ,3 ,4],
"stillisarray": [ 1, 1, 2, 5, 3, 4, 0, 2, 3, 2, 3, 5, 9]
}
```Right:
```json
{
"y": "DIFF ALL THE THINGS!",
"c": null,
"aa": 5,
"b": false,
"z": true,
"e": {
"john": 5,
"mary": 6,
"stephen": 8
},
"common": {
"john": null,
"mary": 5,
"still here": true
},
"equal": "!!!!",
"wasarray": { "test": "5" },
"stillisarray": [ 3, 4, 0, 2, 3, 4, 6, 4, 2, 3, 5, 9]
}
```Diff:
```diff
{
- aa: 7,
+ aa: 5,
+ b: false,
- c: 6,
+ c: null,
common: {
- john: 4,
+ john: null,
+ mary: 5,
still here: true
},
+ e: {
+ john: 5,
+ mary: 6,
+ stephen: 8
+ },
equal: "!!!!",
- removed: {
- blue: false,
- green: false,
- red: true
- },
stillisarray: [
- 1,
- 1,
- 2,
- 5,
3,
4,
0,
2,
3,
+ 4,
+ 6,
+ 4,
2,
3,
5,
9
],
- wasarray: [
- 1,
- 2,
- 3,
- 4
- ],
+ wasarray: {
+ test: "5"
+ },
- y: "diff all the things!",
+ y: "DIFF ALL THE THINGS!",
z: true
}
```