Legend:
Library
Module
Module type
Parameter
Class
Class type
Library
Module
Module type
Parameter
Class
Class type
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;
}
val normalize : Yojson.Safe.json -> Yojson.Safe.json
Convert a real json tree into an atd-compliant form.
val restore : Yojson.Safe.json -> Yojson.Safe.json
Convert an atd-compliant json tree into a real json tree.