Json_reprRepresentations of JSON documents
type 'a view = [ | `O of (string * 'a) listAn associative table (object).
*)| `A of 'a listAn (integer indexed) array.
*)| `Bool of boolA JS boolean true or false.
| `Float of floatA floating point number (double precision).
*)| `String of stringAn UTF-8 encoded string.
*)| `NullThe null constant.
]The internal format used by the library. A common format to view JSON structures from different representations. It only shows the head of structures, hiding the contents of fields, so that the conversion from another format or a stream can be done lazily.
Each representation must provide a unique identifier, obtained via the repr_uid function. This identifier is used when converting between representations, to optimize out a copy when converting from a representation to itself. Beware that this optimization relies only on this uid token. Converting between values of the same type using two different representation modules with different uids will perform a copy. A practical way to ensure that the optimization is made is to write your representations as toplevel modules, and not inside functors.
module type Repr = sig ... endA view over a given implementation.
val convert :
(module Repr with type value = 'tf) ->
(module Repr with type value = 'tt) ->
'tf ->
'ttConvert a JSON value from one representation to another.
val pp :
?compact:bool ->
?pp_string:(Json_data_encoding_stdlib.Format.formatter -> string -> unit) ->
(module Repr with type value = 'tf) ->
Json_data_encoding_stdlib.Format.formatter ->
'tf ->
unitGeneric pretty-printer. If compact is set (by default), then the output is not really pretty (no space is output). Ascii-compatible string encoding is expected, as printing only escapes double quotes and control characters. Use pp_string for more advanced escaping. This function does not claim to be the best JSON pretty printer, it is mostly a small utility.
type ezjsonm = [ | `O of (string * ezjsonm) listAn associative table (object).
*)| `A of ezjsonm listAn (integer indexed) array.
*)| `Bool of boolA JS boolean true or false.
| `Float of floatA floating point number (double precision).
*)| `String of stringAn UTF-8 encoded string.
*)| `NullThe null constant.
]A JSON value compatible with Ezjsonm.value.
type yojson = [ | `Bool of boolA JS boolean true of false.
| `Assoc of (string * yojson) listJSON object.
*)| `Float of floatA floating point number (double precision).
*)| `Int of intA number without decimal point or exponent.
*)| `Intlit of stringA number without decimal point or exponent, preserved as string.
*)| `List of yojson listA JS array.
*)| `NullThe null constant.
| `String of stringAn UTF-8 encoded string.
*)| `Tuple of yojson listA tuple (non-standard). Syntax: ("abc", 123).
*)| `Variant of string * yojson optionA variant (non-standard). Syntax: <"Foo"> or <"Bar": 123>.
*) ]A JSON value compatible with Yojson.Safe.json.
A meta-representation for JSON values that can unify values of different representations by boxing them with their corresponding Repr modules.
Converts a boxed value from its intrinsic representation to the one of the given Repr module. Optimized if the internal representation of the value actually is the requested one.
Boxes a value with a compatible Repr module.
val pp_any :
?compact:bool ->
?pp_string:(Json_data_encoding_stdlib.Format.formatter -> string -> unit) ->
unit ->
Json_data_encoding_stdlib.Format.formatter ->
any ->
unitsee ezjsonm