| json-c
    0.17
    | 
JSON Patch (RFC 6902) implementation for manipulating JSON objects. More...
| Data Structures | |
| struct | json_patch_error | 
| Functions | |
| JSON_EXPORT int | json_patch_apply (struct json_object *copy_from, struct json_object *patch, struct json_object **base, struct json_patch_error *patch_error) | 
JSON Patch (RFC 6902) implementation for manipulating JSON objects.
| JSON_EXPORT int json_patch_apply | ( | struct json_object * | copy_from, | 
| struct json_object * | patch, | ||
| struct json_object ** | base, | ||
| struct json_patch_error * | patch_error | ||
| ) | 
Apply the JSON patch to the base object. The patch object must be formatted as per RFC 6902, i.e. a json_type_array containing patch operations. If the patch is not correctly formatted, an error will be returned.
The json_object at *base will be modified in place. Exactly one of *base or copy_from must be non-NULL. If *base is NULL, a new copy of copy_from will allocated and populated using json_object_deep_copy(). In this case json_object_put() must be used to free *base even if the overall patching operation fails.
If anything fails during patching a negative value will be returned, and patch_error (if non-NULL) will be populated with error details.
| base | a pointer to the JSON object which to patch | 
| patch | the JSON object that describes the patch to be applied | 
| copy_from | a JSON object to copy to *base | 
| patch_error | optional, details about errors | 
 1.8.2
 1.8.2