package atdgen-runtime

  1. Overview
  2. Docs

Support for objects with a single field whose name indicates the type of the value. For instance,

{
  "User": {
    "id": "abc123",
    "age": 52
  }
}

gets converted into

[
  "User",
  {
    "id": "abc123",
    "age": 52
  }
]

An ATD type definition for this is

type obj = [
  | User of user
  | ...
] <json adapter.ocaml="Atdgen_runtime.Json_adapter.One_field">

type user = {
  id: string;
  age: int;
}

Convert a real json tree into an atd-compliant form.

Convert an atd-compliant json tree into a real json tree.

OCaml

Innovation. Community. Security.