Legend:
Library
Module
Module type
Parameter
Class
Class type
Library
Module
Module type
Parameter
Class
Class type
type 'a reader = Yojson.Safe.lexer_state -> Stdlib.Lexing.lexbuf -> 'a
Type of a read_
function as produced by atdgen -json
.
In versions of yojson greater than 1.0.1, type Yojson.Safe.lexer_state
is equivalent to Yojson.lexer_state
, Yojson.Basic.lexer_state
and Yojson.Raw.lexer_state
.
Type of a write_
function as produced by atdgen -json
.
val from_lexbuf :
?stream:bool ->
'a reader ->
Yojson.Safe.lexer_state ->
Stdlib.Lexing.lexbuf ->
'a
Read a JSON value from a lexbuf.
val from_string :
?buf:Stdlib.Buffer.t ->
?fname:string ->
?lnum:int ->
'a reader ->
string ->
'a
Convert a JSON value from a string.
val from_channel :
?buf:Stdlib.Buffer.t ->
?fname:string ->
?lnum:int ->
'a reader ->
Stdlib.in_channel ->
'a
Read a JSON value from a channel.
val from_file :
?buf:Stdlib.Buffer.t ->
?fname:string ->
?lnum:int ->
'a reader ->
string ->
'a
Read a JSON value from a channel.
val seq_from_lexbuf :
?fin:(unit -> unit) ->
'a reader ->
Yojson.Safe.lexer_state ->
Stdlib.Lexing.lexbuf ->
'a Stdlib.Seq.t
Read a stream of JSON values from a lexbuf.
val seq_from_string :
?buf:Stdlib.Buffer.t ->
?fin:(unit -> unit) ->
?fname:string ->
?lnum:int ->
'a reader ->
string ->
'a Stdlib.Seq.t
Read a stream of JSON values from a channel. Values do not have to be separated by newline characters.
val seq_from_channel :
?buf:Stdlib.Buffer.t ->
?fin:(unit -> unit) ->
?fname:string ->
?lnum:int ->
'a reader ->
Stdlib.in_channel ->
'a Stdlib.Seq.t
Read a stream of JSON values from a channel. Values do not have to be separated by newline characters.
val seq_from_file :
?buf:Stdlib.Buffer.t ->
?fin:(unit -> unit) ->
?fname:string ->
?lnum:int ->
'a reader ->
string ->
'a Stdlib.Seq.t
Read a stream of JSON values from a file. Values do not have to be separated by newline characters.
val list_from_string :
?buf:Stdlib.Buffer.t ->
?fin:(unit -> unit) ->
?fname:string ->
?lnum:int ->
'a reader ->
string ->
'a list
Read a list of JSON values from a channel. Values do not have to be separated by newline characters.
val list_from_channel :
?buf:Stdlib.Buffer.t ->
?fin:(unit -> unit) ->
?fname:string ->
?lnum:int ->
'a reader ->
Stdlib.in_channel ->
'a list
Read a list of JSON values from a channel. Values do not have to be separated by newline characters.
val list_from_file :
?buf:Stdlib.Buffer.t ->
?fname:string ->
?lnum:int ->
'a reader ->
string ->
'a list
Read a list of JSON values from a file. Values do not have to be separated by newline characters.
val to_string : ?len:int -> 'a writer -> 'a -> string
Write a JSON value to a string.
val to_channel : ?len:int -> 'a writer -> Stdlib.out_channel -> 'a -> unit
Write a JSON value to a channel.
val to_file : ?len:int -> 'a writer -> string -> 'a -> unit
Write a JSON value to a file.
val seq_to_string :
?len:int ->
?lf:string ->
'a writer ->
'a Stdlib.Seq.t ->
string
Write a stream of values to a string.
val seq_to_channel :
?len:int ->
?lf:string ->
'a writer ->
Stdlib.out_channel ->
'a Stdlib.Seq.t ->
unit
Write a stream of values to a channel.
val seq_to_file :
?len:int ->
?lf:string ->
'a writer ->
string ->
'a Stdlib.Seq.t ->
unit
Write a stream of values to a file.
val list_to_string : ?len:int -> ?lf:string -> 'a writer -> 'a list -> string
Write a list of values to a string.
val list_to_channel :
?len:int ->
?lf:string ->
'a writer ->
Stdlib.out_channel ->
'a list ->
unit
Write a list of values to a channel.
val list_to_file :
?len:int ->
?lf:string ->
'a writer ->
string ->
'a list ->
unit
Write a list of values to a file.
preset_unknown_field_handler src_loc field_name
raises a Failure
exception with a message containing the location of the type definition in the source ATD file (src_loc
) and the name of the field (field_name
).
Function called when an unknown JSON field is encountered if the code was generated by atdgen -json-strict-fields. Its preset behavior is to call preset_unknown_field_handler
which raises a Failure
exception.
Usage: !Atdgen_runtime.Util.Json.unknown_field_handler src_loc field_name
where src_loc
is the location of the type definition in the source ATD file and field_name
is the unknown JSON field name.