Bindoj_codec.Json
This module provides functions for interconversion between JSON values and OCaml values.
module Json_config = Bindoj_codec_config.Json_config
val get_json_discriminator_value :
'a Bindoj_base.Typed_type_desc.typed_type_decl ->
'a ->
string
val validate_spreading_type :
[< `direct of Bindoj_base.Typed_type_desc.coretype
| `nested of
Bindoj_base.Typed_type_desc.type_decl
* Bindoj_base.Typed_type_desc.Coretype.codec ] ->
[ `record_decl of
Bindoj_base.Typed_type_desc.type_decl
* Bindoj_base.Typed_type_desc.record_field list
* Bindoj_base.Typed_type_desc.Coretype.codec
| `variant_decl of
Bindoj_base.Typed_type_desc.type_decl
* Bindoj_base.Typed_type_desc.variant_constructor list
* Bindoj_base.Typed_type_desc.Coretype.codec ]
val explain_encoded_json_shape' :
('shape, 'field_shape) Bindoj_runtime.json_shape_explaner ->
((Bindoj_base.Typed_type_desc.type_decl -> 'shape) ->
Bindoj_base.Typed_type_desc.Coretype.codec ->
Bindoj_base.Typed_type_desc.Coretype.ident ->
string ->
'shape) ->
Bindoj_base.Typed_type_desc.type_decl ->
'shape
Creates a json shape explanation of the give typed type declaration with the given json shape explaner.
val explain_encoded_json_shape :
env:Bindoj_base.Typed_type_desc.tdenv ->
't Bindoj_base.Typed_type_desc.typed_type_decl ->
Bindoj_runtime.json_shape_explanation
Creates a json shape explanation of the give typed type declaration.
val of_json' :
env:Bindoj_base.Typed_type_desc.tdenv ->
'a Bindoj_base.Typed_type_desc.typed_type_decl ->
Kxclib.Json.jv ->
'a Bindoj_runtime.OfJsonResult.t
Converts the provided JSON value to the corresponding OCaml value, if possible.
val of_json :
env:Bindoj_base.Typed_type_desc.tdenv ->
'a Bindoj_base.Typed_type_desc.typed_type_decl ->
Kxclib.Json.jv ->
'a option
Converts the provided JSON value to the corresponding OCaml value. This function acts same as of_json'
.
val to_json :
env:Bindoj_base.Typed_type_desc.tdenv ->
'a Bindoj_base.Typed_type_desc.typed_type_decl ->
'a ->
Kxclib.Json.jv
Converts an OCaml value to a JSON value.