Expand description
§JSON Diff/Patch/Merge
High-performance JSON structural operations with SIMD acceleration.
This module provides three related capabilities:
§JSON Diff
Generate a list of operations that transform one JSON document into another. Follows the spirit of RFC 6902 (JSON Patch) for the output format.
§JSON Patch (RFC 6902)
Apply a sequence of operations to a JSON document:
add: Insert a value at a pathremove: Delete a value at a pathreplace: Replace a value at a pathmove: Move a value from one path to anothercopy: Copy a value from one path to anothertest: Verify a value equals the expected value
§JSON Merge Patch (RFC 7396)
A simpler merge format where:
- Objects are recursively merged
nullvalues indicate deletion- Other values replace existing ones
§Performance
Uses SIMD acceleration for:
- Bulk string comparison (detect unchanged strings quickly)
- Array element comparison
- Finding longest common subsequence in arrays
Structs§
- Diff
Options - Options for diff generation.
- Json
Patch - A JSON Patch document (sequence of operations).
- Json
Patch Ref - A JSON Patch document with zero-copy operations.
Enums§
- Patch
Error - Error type for patch operations.
- Patch
Operation - A single patch operation.
- Patch
Operation Ref - A single patch operation with zero-copy paths where possible.
Functions§
- apply_
patch - Apply a JSON Patch to a value, returning a new value.
- apply_
patch_ mut - Apply a JSON Patch to a value in place.
- deep_
merge - Deep merge two objects, preferring values from
overlay. - json_
diff - Generate a JSON Patch that transforms
sourceintotarget. - json_
diff_ with_ options - Generate a JSON Patch with custom options.
- json_
diff_ zerocopy - Generate a zero-copy JSON Patch that transforms
sourceintotarget. - json_
merge_ patch - Apply a JSON Merge Patch (RFC 7396) to a document.
- json_
numbers_ equal - Compare two JSON number representations for equality.
- json_
strings_ equal - Compare two JSON string values for equality.
- merge_
many - Merge multiple JSON documents using merge patch semantics.
- merge_
patch_ to_ value - Generate a merge patch from two JSON documents.
- simd_
bytes_ equal - SIMD-accelerated byte slice equality check.
- simd_
find_ first_ difference - Find the first position where two byte slices differ.