我从 js 端得到了一个数据,看起来像这样
{
"selectionSet": {
"type": 1,
"selections": [
{
"name": {
"kind": "Name",
"value": "viewer"
},
"selectionSet": {
"type": 1,
"selections": [
{
"name": {
"kind": "Name",
"value": "avatarUrl"
},
"selectionSet": null
}
]
}
}
]
}
}
我想知道如何为selectionSetand定义类型selections。
似乎在定义时selections,我应该定义,selectionSet因为它有一个类型为的字段selectionSet。但是当定义时selectionSet,我应该定义selections
有人可以用 OCaml 风格回答吗?我想将此 JSON 样式数据转换为记录。