Resolve paths and existing parents
02A path names the place to edit. Adding a missing leaf is allowed, but its containing object or array must already exist.
Separate example: add at path "" with value["tea"] replaces the whole target with that array.
Source for this drawing: RFC 6902 · Read RFC section 4.1 ↗
New to this? Start hereA quick picture + helpful background
First, agree how to read the message.
An encoding tells a reader how to interpret bytes. A format tells it how values fit together. Correctly reading a value does not make that value trustworthy.
Helpful first, if these ideas are unfamiliar
These pictures are analogies to help you learn. The linked RFC explains the actual rules.
Terms in this drawing
Related RFCs and changes
“Updates” changes part of an earlier RFC. “Obsoletes” replaces it. This list shows selected related documents.
Creating a member does not create missing ancestors.
- JSON Pointer decodes ~1 to slash, then ~0 to tilde. Thus /a~1b/~0name selects the member ~name inside the object named a/b. JSON string escapes are decoded before pointer evaluation; path is not a URI-fragment string.
- add MUST include value. At an existing object member it replaces the value; at a new member it creates the member. The parent object or array must exist. A missing parent is an error; add does not build an arbitrary ancestor tree.
- The empty pointer string names the whole target document. add there makes value the entire document, even if its type changes. Root removal is not taught here: held erratum4787 proposes a restriction, but that proposal is not a published MUST NOT.
The hierarchy uses literal fictional member names. RFC6901§§3–5 defines the pointer notation; RFC6902 defines what add may do at the resulting location. No percent-decoding or dot-path interpretation is implied.
Read the RFC section ↗