Legend:
Library
Module
Module type
Parameter
Class
Class type
Library
Module
Module type
Parameter
Class
Class type
type json = [
| `O of (string * json) list
| `Bool of bool
| `Float of float
| `A of json list
| `Null
| `String of string
]
In memory JSON data, compatible with Ezjsonm
.
type t = json
type schema = Json_schema.schema
val encoding : json Encoding.t
Encodes raw JSON data (BSON is used for binary).
val schema_encoding : schema Encoding.t
Encodes a JSON schema (BSON encoded for binary).
val convert : 'a Encoding.t -> 'a Json_encoding.encoding
Create a Json_encoding.encoding
from an encoding
.
val schema : ?definitions_path:string -> 'a Encoding.t -> schema
Generate a schema from an encoding
.
val construct : 't Encoding.t -> 't -> json
Construct a JSON object from an encoding.
val destruct : 't Encoding.t -> json -> 't
Destruct a JSON object into a value. Fail with an exception if the JSON object and encoding do not match..
JSON Error.
type path = path_item list
and path_item = [
| `Field of string
A field in an object.
*)| `Index of int
An index in an array.
*)| `Star
Any / every field or index.
*)| `Next
The next element after an array.
*) ]
A set of accessors that point to a location in a JSON object.
exception Cannot_destruct of path * exn
Exception raised by destructors, with the location in the original JSON structure and the specific error.
val print_error :
?print_unknown:(Format.formatter -> exn -> unit) ->
Format.formatter ->
exn ->
unit
val cannot_destruct : ('a, Format.formatter, unit, 'b) format4 -> 'a
Helpers for writing encoders.
val to_string : ?newline:bool -> ?minify:bool -> json -> string
Write a JSON document to a string. This goes via an intermediate buffer and so may be slow on large documents.
val pp : Format.formatter -> json -> unit