B0_json.JsonGeneric JSON values.
type meta = B0_text.Textloc.tThe type for node metadata.
val meta_none : metameta_none is an invalid input location.
type 'a node = 'a * metaAbstract syntax tree nodes.
type name = string nodeThe type for generic JSON object names.
and object' = mem listThe type for generic JSON objects.
compare j0 j1 is a total order on JSON values:
Float.compare, this means NaN values are equal.normalize j normalizes JSON j by sorting object's members by name using String.compare.
The type for constructing JSON values from an OCaml value of type 'a. meta default to meta_none.
val null : unit consnull is Null (unit, meta).
val bool : bool consbool b is Bool (b, meta).
val number : float consnumber n is Number (b, meta).
val any_float : float consany_float v is number v if Float.is_finit v is true and string Float.to_string v otherwise.
val string : string consstring s is `String (s, meta).
val of_string :
?file:B0_text.Textloc.filepath ->
string ->
(t, string) Stdlib.resultof_string s parses JSON text from s according to RFC8259 with the following limitations:
string_of_float which is not compliant.Note. All OCaml strings returned by this function are UTF-8 encoded.
val to_string : t -> stringto_string j is j as JSON text, encoded according to RFC8259.
Warning. Assumes all OCaml strings in j are UTF-8 encoded.
The type for JSON number formatters.
val default_number_format : number_formatdefault_number_format is "%.17g". This number formats ensures that finite floating point values can be interchanged without loss of precision.
val pp' :
?number_format:number_format ->
unit ->
Stdlib.Format.formatter ->
t ->
unitpp' ~format ~number_format () ppf j formats j on ppf. The output is indented but may be more compact than an Indent JSON encoder may do. For example arrays may be output on one line if they fit etc.
number_format is used to format JSON numbers. Defaults to default_number_format