Expand description
This module provides some unofficial “extensions” to the jsonpatch
format for describing changes to a JSON document. In particular, it adds the *
operator as a
valid token for arrays in a JSON document. It means: apply this change to all elements of this
array. For example, consider the following document:
{
"foo": {
"bar": [
{"baz": 1},
{"baz": 2},
{"baz": 3},
]
}
}
The pathspec /foo/bar/*/baz
would reference the baz
field of all three array entries in the
bar
array. It is an error to use *
to reference a field that is not an array. It is an
error to use *
at the end of a path, e.g., /foo/*
.
Additionally, this crate will auto-create parent paths for the AddOperation only, e.g., the
result of applying AddOperation{ path: "/foo/bar", value: 1 }
to the empty document will be
{ "foo": {"bar": 1}}
Re-exports§
pub use json_patch::AddOperation;
pub use json_patch::CopyOperation;
pub use json_patch::MoveOperation;
pub use json_patch::Patch;
pub use json_patch::PatchOperation;
pub use json_patch::RemoveOperation;
pub use json_patch::ReplaceOperation;
pub use json_patch::TestOperation;
Modules§
Macros§
Structs§
- Pointer
- A JSON Pointer is a string containing a sequence of zero or more reference
Token
s, each prefixed by a'/'
character. - Pointer
Buf - An owned, mutable
Pointer
(akin toString
). - Token
- A
Token
is a segment of a JSONPointer
, preceded by'/'
(%x2F
).