Module 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

Creates a json shape explanation of the give typed type declaration with the given json shape explaner.

Creates a json shape explanation of the give typed type declaration.

Converts the provided JSON value to the corresponding OCaml value, if possible.

  • parameter env

    Environment where the type declarations are added.

  • parameter typed_type_decl

    A typed type declaration that specifies how to convert the value.

  • parameter jv

    JSON value to be converted.

  • returns

    The converted OCaml value encapsulated in an OfJsonResult type.

Converts the provided JSON value to the corresponding OCaml value. This function acts same as of_json'.

  • parameter env

    Environment where the type declarations are added.

  • parameter typed_type_decl

    A typed type declaration that specifies how to convert the value.

  • parameter jv

    JSON value to be converted.

  • returns

    The converted OCaml value if possible, else None.

Converts an OCaml value to a JSON value.

  • parameter env

    Environment where the type declarations are added.

  • parameter typed_type_decl

    A typed type declaration that specifies how to convert the value.

  • parameter 'a

    OCaml value to be converted.

  • returns

    The converted JSON value.