Crates.io | jsondiffpatch_rs |
lib.rs | jsondiffpatch_rs |
version | 0.1.0 |
source | src |
created_at | 2023-03-12 08:54:40.550577 |
updated_at | 2023-03-12 08:54:40.550577 |
description | A command line tool to diff and patch JSON documents |
homepage | https://github.com/Nero5023/jsondiffpatch.rs |
repository | https://github.com/Nero5023/jsondiffpatch.rs |
max_upload_size | |
id | 807890 |
size | 40,173 |
Diff & patch json object.
USAGE:
jsondiffpath-cli <SUBCOMMAND>
OPTIONS:
-h, --help Print help information
SUBCOMMANDS:
diff diff two json file
help Print this message or the help of the given subcommand(s)
patch patch a json object with a patch document
diff two json file
USAGE:
jsondiffpath-cli diff <LEFT_JSON> <RIGHT_JSON>
ARGS:
<LEFT_JSON>
<RIGHT_JSON>
OPTIONS:
-h, --help Print help information
LEFT_JSON:
{
"bar": [
1, 2, 3
],
"foo": 10
}
RIGHT_JSON:
{
"bar": [
2, 3, 4
],
"foo": 11
}
diff:
USAGE:
jsondiffpath-cli patch <ORIGINAL_JSON> <PATCH_JSON>
ARGS:
<ORIGINAL_JSON>
<PATCH_JSON>
OPTIONS:
<ORIGINAL_JSON> is the base file to apply to the patch
<PATCH_JSON> is the patch file to apply to the base json (followed by JSON-Patch RFC6902)
jsondiffpatch-cli patch [left.json] [right.json]
ORIGINAL_JSON:
{
"foo": "Hello World",
"bar": "Unknown"
}
PATCH_JSON:
[
{ "op": "replace", "path": "/foo", "value": "new value" },
{ "op": "add", "path": "/baz", "value": "added value" },
{ "op": "remove", "path": "/bar" }
]
result:
{
"baz": "added value",
"foo": "new value"
}