Merge pull request #28 from munisystem/master Fix typo in README.md
Merge pull request #28 from munisystem/master
Fix typo in README.md
go get github.com/yudai/gojsondiff
See jd/main.go for how to use this library.
jd/main.go
This repository contains a package that you can use as a CLI tool.
go get github.com/yudai/gojsondiff/jd
Just give two json files to the jd command:
jd
jd one.json another.json
Outputs would be something like:
{ "arr": [ 0: "arr0", 1: 21, 2: { "num": 1, - "str": "pek3f" + "str": "changed" }, 3: [ 0: 0, - 1: "1" + 1: "changed" ] ], "bool": true, "num_float": 39.39, "num_int": 13, "obj": { "arr": [ 0: 17, 1: "str", 2: { - "str": "eafeb" + "str": "changed" } ], + "new": "added", - "num": 19, "obj": { - "num": 14, + "num": 9999 - "str": "efj3" + "str": "changed" }, "str": "bcded" }, "str": "abcde" }
When you prefer the delta format of jsondiffpatch, add the -f delta option.
-f delta
jd -f delta one.json another.json
This command shows:
{ "arr": { "2": { "str": [ "pek3f", "changed" ] }, "3": { "1": [ "1", "changed" ], "_t": "a" }, "_t": "a" }, "obj": { "arr": { "2": { "str": [ "eafeb", "changed" ] }, "_t": "a" }, "new": [ "added" ], "num": [ 19, 0, 0 ], "obj": { "num": [ 14, 9999 ], "str": [ "efj3", "changed" ] } } }
Give a diff file in the delta format and the JSON file to the jp command.
jp
jp diff.delta one.json
MIT License (see LICENSE for detail)
LICENSE
版权所有:中国计算机学会技术支持:开源发展技术委员会 京ICP备13000930号-9 京公网安备 11010802032778号
Go JSON Diff (and Patch)
How to use
Installation
Comparing two JSON strings
See
jd/main.gofor how to use this library.CLI tool
This repository contains a package that you can use as a CLI tool.
Installation
Usage
Diff
Just give two json files to the
jdcommand:Outputs would be something like:
When you prefer the delta format of jsondiffpatch, add the
-f deltaoption.This command shows:
Patch
Give a diff file in the delta format and the JSON file to the
jpcommand.License
MIT License (see
LICENSEfor detail)