Module Brr.Json

JSON codec.

As codec by the JSON object.

Note. This interface is not particularly useful for programming in OCaml. To map JSON schemas to OCaml and back, describe your JSON with jsont. The jsont.brr library can use these descriptions with the JSON codec provided by your JavaScript runtime.

type t = Jv.t

The type for JSON values.

val encode : t -> Jstr.t

encode v encodes v to JSON using JSON.stringify.

Warning. Do not expect an encode on a Jv.repr of an OCaml value to be decoded back by decoded.

val decode : Jstr.t -> (t, Jv.Error.t) Stdlib.result

decode s decodes the JSON text s into a JavaScript value using JSON.parse.