/claim #679
Complete implementation of the Json data type for Issue #679. Introduces first-class JSON representation to zio-blocks with type-safe manipulation and deep Schema integration.
Object, Array, String, Number, Boolean, NullNumber stores values as strings to preserve full precisionJsonSelection for fluent traversal with error accumulationDynamicOptic, array indices, or object keysone, first, toArray| Method | Description |
|---|---|
set / setOrFail |
Replace value at path |
delete / deleteOrFail |
Remove value at path |
insert / insertOrFail |
Insert into arrays |
modify / modifyOrFail |
Transform value at path |
transformUp / transformDown for bottom-up and top-down traversaltransformKeys for bulk field renamingfoldUp / foldDown with OrFail variantsfilter / filterNot on path-value pairsFive built-in strategies:
normalize - Sort keys, standardize numberssortKeys - Recursive key orderingdropNulls / dropEmpty - Remove null values and empty containersdiff - Produce RFC 6902 JsonPatch between two valuespatch / patchUnsafe - Apply JsonPatch operationsadd, remove, replace, move, copy, testBatch wrapper for composing multiple operationscheck / conforms for basic JsonSchema validationInput formats: String, CharSequence, Array[Byte], Chunk, ByteBuffer, Reader
Output formats: String, Array[Byte], Chunk, ByteBuffer, Writer
Typed conversion: as[A] / asUnsafe[A] via JsonDecoder
JsonEncoder[A] and JsonDecoder[A] type classesJsonBinaryCodec takes priority over schema derivationp"path.to[0].field" - Path constructionj"""{"key": "value"}""" - JSON literal parsingtoDynamicValue / fromDynamicValue with full round-trip fidelitytoKV / fromKV for flat path-value representationJsonPatch and JsonSchema are working but minimal placeholders, consistent with the issue marking them out-of-scope. Patch functionality supports diff/patch round-trips. Schema validation covers common cases but is not a full JSON Schema implementation.
https://github.com/user-attachments/assets/5b1f59f3-dd41-4854-884c-a2c3939ddac3
Nati
@natinew77-creator
ZIO
@ZIO
Jacques Anidjar
@jacanidjar