3
我有一個樹結構,我想創建一個JSON模式。如何爲樹結構創建JSON模式?
類結構
class Node {
String id;
List<Node> children = new ArrayList<>();
}
的JSON模式至今:
{
"name": "node",
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "The node id",
"required": true
}
"children": {
"type": "array",
"items": {
//The items of array should be node ?
}
}
}
}
我的問題是,我不知道我應該如何描述陣列的JSON內容"items"
?
在此先感謝您的答覆。
你可以做的一件事,你可以創建一個JavaScript對象作爲樹結構,然後將其字符串化爲 –
我需要這樣做的文件目的。 –