add abstract method

Object? add(
  1. Object? document,
  2. Object? newValue
)

Returns a copy of document with the newValue added at the referenced location.

The semantics of this method is the same as the "add" operation described in RFC 6902 (JSON Patch).

  • If the target location specifies an array index, the value is inserted at the specified index shifting existing values.
  • If the target location is an key in an object, it will be added or replaced by the newValue

If any of the intermediate keys and indexes is missing, a BadRoute exception will be thrown.

Implementation

Object? add(Object? document, Object? newValue);