Crate json_patch_ext

Source
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§

Macros§

Structs§

  • A JSON Pointer is a string containing a sequence of zero or more reference Tokens, each prefixed by a '/' character.
  • An owned, mutable Pointer (akin to String).

Enums§

Functions§