You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+20Lines changed: 20 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,7 @@
3
3
json-diff-cli allows you to diff the JSON of two urls and see what the differences are. This tool can be used for testing purposes or to simply check that things are working.
4
4
5
5
# Usage
6
+
6
7
```
7
8
Commands:
8
9
@@ -13,15 +14,19 @@ Commands:
13
14
```
14
15
15
16
## DIFF
17
+
16
18
### diff the json between two urls and print to the console.
19
+
17
20
```
18
21
jsondiff diff <leftURL> <rightURL> [options]
19
22
```
23
+
20
24
**`leftURL`**: The base URL you would like to compare to.
21
25
22
26
**`rightURL`**: The new/updated URL. The JSON from `rightURL` will be compared with the `leftURL` and changes will be printed out to the console.
23
27
24
28
### Options
29
+
25
30
```
26
31
Usage: diff [options] <leftURL> <rightURL>
27
32
@@ -31,6 +36,7 @@ Options:
31
36
32
37
--help output usage information
33
38
-o, --output <file> print the output to a CSV file
39
+
-f, --failOnDiff return exit code 1 if there is a difference
34
40
-x, --diffheaders diff the headers as well as the body
35
41
-H, --headers <string> attach a header to the request. You may string multipe headers together by passing along more -H or --header options
36
42
-i, --ignore <key> ignore the provided key. You may string multipe ignore keys together by passing along more -i or --ignore options
@@ -43,7 +49,9 @@ Options:
43
49
### Example
44
50
45
51
#### Input
52
+
46
53
##### leftJSON
54
+
47
55
```json
48
56
{
49
57
"foo": {
@@ -54,7 +62,9 @@ Options:
54
62
}
55
63
}
56
64
```
65
+
57
66
##### rightJSON
67
+
58
68
```json
59
69
{
60
70
"foo": {
@@ -67,6 +77,7 @@ Options:
67
77
```
68
78
69
79
#### Output
80
+
70
81
```
71
82
key left right diff
72
83
--------- ------------ ------------ -------
@@ -76,6 +87,7 @@ foo.bar.a true false updated
76
87
```
77
88
78
89
## CSV
90
+
79
91
### diff the json between urls in a csv file, print to the console, and output into a csv file.
80
92
81
93
```
@@ -85,6 +97,7 @@ jsondiff csv <input> [options]
85
97
**`input`**: Path to the input file (CSV format).
86
98
87
99
### Options
100
+
88
101
```
89
102
Usage: csv [options] <path>
90
103
@@ -100,8 +113,11 @@ Options:
100
113
```
101
114
102
115
### Example
116
+
103
117
#### Input
118
+
104
119
**The first line in the CSV file must have the following headers. You may chose to omit any of them except for `ur1`, and `url2`**
0,https://gist.githubusercontent.com/nahtnam/920171eeef10e911a6ee7698d9c226ae/raw/bdd86427b8c807e149251d4737d2886620f7fcdc/a.json,1197,https://gist.githubusercontent.com/nahtnam/920171eeef10e911a6ee7698d9c226ae/raw/bdd86427b8c807e149251d4737d2886620f7fcdc/b.json,675,foo.bar.c,undefined,now you dont,added,fail
2,https://gist.githubusercontent.com/nahtnam/920171eeef10e911a6ee7698d9c226ae/raw/bdd86427b8c807e149251d4737d2886620f7fcdc/a.json,396,https://gist.githubusercontent.com/nahtnam/920171eeef10e911a6ee7698d9c226ae/raw/bdd86427b8c807e149251d4737d2886620f7fcdc/b.json,386,foo.bar.b,now u see me,undefined,deleted,fail
https://gist.githubusercontent.com/nahtnam/920171eeef10e911a6ee7698d9c226ae/raw/bdd86427b8c807e149251d4737d2886620f7fcdc/a.json vs https://gist.githubusercontent.com/nahtnam/920171eeef10e911a6ee7698d9c226ae/raw/bdd86427b8c807e149251d4737d2886620f7fcdc/b.json
0 commit comments