RFC6901 JSON Pointer implementation in OCaml using jsont

readme

Changed files
+57
+57
README.md
··· 1 + # json-pointer - RFC 6901 JSON Pointer for OCaml 2 + 3 + A complete RFC 6901 JSON Pointer implementation for OCaml, providing parsing, 4 + serialization, evaluation, and mutation operations compatible with jsont 5 + codecs. 6 + 7 + ## Key Features 8 + 9 + - Full RFC 6901 compliance with proper escape sequence handling 10 + - Type-safe phantom types distinguish navigation vs append pointers 11 + - Mutation operations for RFC 6902 JSON Patch support 12 + - JMAP extended pointers (RFC 8620) with wildcard support 13 + 14 + ## Usage 15 + 16 + ```ocaml 17 + (* Parse and evaluate a JSON Pointer *) 18 + let json = Jsont_bytesrw.decode_string Jsont.json 19 + {|{"foo": ["bar", "baz"], "a/b": 1}|} |> Result.get_ok 20 + 21 + let value = Json_pointer.(get (of_string_nav "/foo/0") json) 22 + (* value = Jsont.String ("bar", _) *) 23 + 24 + (* Escape sequences: ~1 for /, ~0 for ~ *) 25 + let value = Json_pointer.(get (of_string_nav "/a~1b") json) 26 + (* value = Jsont.Number ("1", _) *) 27 + ``` 28 + 29 + Mutations for JSON Patch operations: 30 + 31 + ```ocaml 32 + (* Add a new element to an array *) 33 + let json' = Json_pointer.(add (of_string "/foo/-") json 34 + ~value:(Jsont.Json.string "qux")) 35 + 36 + (* Remove an element *) 37 + let json' = Json_pointer.(remove (of_string_nav "/foo/0") json) 38 + ``` 39 + 40 + ## Installation 41 + 42 + ``` 43 + opam install json-pointer 44 + ``` 45 + 46 + ## Documentation 47 + 48 + API documentation is available via: 49 + 50 + ``` 51 + opam install json-pointer 52 + odig doc json-pointer 53 + ``` 54 + 55 + ## License 56 + 57 + ISC