Package com.flipkart.zjsonpatch
package com.flipkart.zjsonpatch
Core zjsonpatch API for JSON Patch operations according to RFC 6902.
This package provides the main public APIs for creating and applying JSON patches. The library supports both Jackson 2.x and Jackson 3.x with separate API entry points.
API Selection
Users must explicitly use the correct public API based on their Jackson version:
JsonDiffandJsonPatchfor Jackson 2.xJackson3JsonDiffandJackson3JsonPatchfor Jackson 3.x
Separate APIs are necessary because:
- The original API is based on Jackson 2.x types and cannot be changed without breaking compatibility
- A unified API is not possible since only one Jackson version may be available in the classpath with incompatible package structures
Basic Usage
For Jackson 2.x:
// Create JSON nodes using Jackson 2.x ObjectMapper
JsonNode source = mapper.readTree("{\"foo\":\"bar\"}");
JsonNode target = mapper.readTree("{\"foo\":\"baz\"}");
// Generate and apply patch
JsonNode patch = JsonDiff.asJson(source, target);
JsonNode result = JsonPatch.apply(patch, source);
For Jackson 3.x:
// Create JSON nodes using Jackson 3.x ObjectMapper
JsonNode source = mapper.readTree("{\"foo\":\"bar\"}");
JsonNode target = mapper.readTree("{\"foo\":\"baz\"}");
// Generate and apply patch
JsonNode patch = Jackson3JsonDiff.asJson(source, target);
JsonNode result = Jackson3JsonPatch.apply(patch, source);
- See Also:
-
ClassDescriptionCreated by tomerga on 04/09/2016.User: holograph Date: 03/08/16Jackson 3.x compatible JSON Diff implementation.Jackson 3.x compatible JSON Patch implementation.Implements RFC 6901 (JSON Pointer)User: gopi.vishwakarma Date: 30/07/14User: gopi.vishwakarma Date: 31/07/14User: holograph Date: 03/08/16Implements RFC 6901 (JSON Pointer)Represents a key reference for array element matching in JSON Pointer.A JSON patch processor that does nothing, intended for testing and validation.User: gopi.vishwakarma Date: 30/07/14Represents a single JSON Pointer reference token.