123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165moduletypeS=sigincludeOjs.TexceptionDecode_errorofstringvaltry_parse_opt:string->toption(** Try to parse the string into JSON, return [Some] if successful, [None] otherwise *)valtry_parse_exn:string->t(** Try to parse the string into JSON, raise {!Decode_error} if it fails *)valstringify:?spaces:int->t->string(** Use [JSON.stringify] to turn JSON into a string.
Specify [spaces] to control the indentation size. *)moduleDecode:sigtype'adecoder=t->'a(** The type for decoder functions which turn JSON into an OCaml value
functions that are unsuccessful in decoding the JSON raise [Decode_error] *)valid:tdecoder(** Identity decoder returns its argument unchanged *)valnull:Ojs.tdecoder(** Only decode a JSON [null] *)valbool:booldecoder(** Decode [true] or [false] *)valfloat:floatdecoder(** Decode a JSON number *)valint:intdecoder(** Decode a finite non-decimal JSON number *)valstring:stringdecoder(** Decode a JSON string *)valchar:chardecoder(** Decode a single-character JSON string *)valnullable:'adecoder->'aoptiondecoder(** Transform a decoder so it decodes nulls as [None] and other decoded values as [Some] *)valarray:'adecoder->'aarraydecoder(** Decode a JSON array of values based on the given decoder *)vallist:'adecoder->'alistdecoder(** Decode an JSON array of values as a list *)valpair:'adecoder->'bdecoder->('a*'b)decoder(** Decode a 2-element JSON array with the given decoders *)valtuple2:'adecoder->'bdecoder->('a*'b)decoder(** Decode a 2-element JSON array with the given decoders *)valtuple3:'adecoder->'bdecoder->'cdecoder->('a*'b*'c)decoder(** Decode a 3-element JSON array with the given decoders *)valtuple4:'adecoder->'bdecoder->'cdecoder->'ddecoder->('a*'b*'c*'d)decoder(** Decode a 4-element JSON array with the given decoders *)valdict:'adecoder->(string,'a)Hashtbl.tdecoder(** Decode a JSON dictionary as a hash table of strings to decoded values *)valfield:string->'adecoder->'adecoder(** Decode an element of a JSON dictionary with the decoder *)valat:stringlist->'adecoder->'adecoder(** Follow a list of field names and decode the final element with the decoder *)valtry_optional:'adecoder->'aoptiondecoder(** Catch [Decode_error], return [None] if raised *)valtry_default:'a->'adecoder->'adecoder(** Catch [Decode_error], return a default value if raised *)valany:'adecoderlist->'adecoder(** Try a list of decoders until one succeeds, raise [Decode_error] if none succeed *)valeither:'adecoder->'adecoder->'adecoder(** Try two decoders, raise [Decode_error] if neither succeed *)valmap:('a->'b)->'adecoder->'bdecoder(** Apply a function to the result of the decoder *)valbind:('a->'bdecoder)->'adecoder->'bdecoder(** Apply the decoder returned from the function *)endmoduleEncode:sigtype'aencoder='a->t(** The type for encoder functions which turn ocaml values into JSON *)valid:tencoder(** Identity encoder which returns its argument unchanged *)valnull:t(** The null JSON value *)valbool:boolencoder(** Encode a boolean into a JSON boolean *)valfloat:floatencoder(** Encode a float as a JSON number *)valint:intencoder(** encode an integer as JSON number *)valstring:stringencoder(** Encode a string as a JSON string *)valchar:charencoder(** Encode a character as a JSON string *)valnullable:'aencoder->'aoptionencoder(** Encode a value with the decoder if [Some], return a JSON null if [None] *)valarray:'aencoder->'aarrayencoder(** Encode an array as a JSON array *)vallist:'aencoder->'alistencoder(** Encode a list as a JSON array *)valpair:'aencoder->'bencoder->('a*'b)encoder(** Encode a 2-element tuple as a JSON array *)valtuple2:'aencoder->'bencoder->('a*'b)encoder(** Encode a 2-element tuple as a JSON array *)valtuple3:'aencoder->'bencoder->'cencoder->('a*'b*'c)encoder(** Encode a 3-element tuple as a JSON array *)valtuple4:'aencoder->'bencoder->'cencoder->'dencoder->('a*'b*'c*'d)encoder(** Encode a 4-element tuple as a JSON array *)valdict:'aencoder->(string,'a)Hashtbl.tencoder(** Encode a hash table as a JSON dict *)valobject_:(string*t)listencoder(** Encode the pairs of keys and values as a JSON dict *)endendmoduletypeJsonoo=sigincludeS(** @inline *)moduletypeS=SmoduleMake(T:Ojs.T):Swithtypet=T.tend