package jsont
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha512=6206f73a66cb170b560a72e58f70b9fb2c20397b9ab819dceba49b6602b9b79e47ba307e6910e61ca4694555c66fdcd7a17490afb99548e8f43845a5a88913e7
doc/jsont.brr/Jsont_brr/index.html
Module Jsont_brrSource
JavaScript support.
Note. These functions incur a bit of overhead but should work fast enough for medium sized structures. Get in touch if you run into problems, some improvements may be possible.
The JSON functions use JavaScript's JSON.parse and JSON.stringify to convert to JavaScript values which are then converted with decode_jv and encode_jv. Parse locations and layout preservation are unsupported.
Decode
decode t s decodes the JSON data s according to t.
decode' t s is like decode but preserves the error structure.
decode_jv t v decodes the JavaScript value v according to t.
decode_jv' is like decode_jv' but preserves the error structure.
Encode
encode t v encodes v to JSON according to t. format specifies how the JSON is formatted, defaults to Jsont.format.Minify. The Jsont.format.Layout format is unsupported, Jsont.format.Indent is used instead.
encode' is like encode but preserves the error structure. format specifies how the JSON is formatted, defaults to Jsont.format.Minify. The Jsont.format.Layout format is unsupported, Jsont.format.Indent is used instead.
encode_jv t v encodes v to a JavaScript value according to t.
encode_jv' is like encode_jv but preserves the error structure.
Recode
recode is decode_jv' followed by encode_jv'.