val normalize : Yojson.Safe.t -> Yojson.Safe.tConvert a real json tree into an atd-compliant form.
val restore : Yojson.Safe.t -> Yojson.Safe.tConvert an atd-compliant json tree into a real json tree.
Json_adapter.One_fieldSupport 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;
}val normalize : Yojson.Safe.t -> Yojson.Safe.tConvert a real json tree into an atd-compliant form.
val restore : Yojson.Safe.t -> Yojson.Safe.tConvert an atd-compliant json tree into a real json tree.