我已經粘貼了一個示例JSON結構,我試圖用java程序實現,最後輸出應該在JSONObject中。我嘗試使用地圖,但如果我沒有出錯,它變得非常複雜。使用java獲取複雜的JSON結構
{
"name": "flare",
"children": [
{
"name": "analytics",
"children": [
{
"name": "cluster",
"children": [
{"name": "AgglomerativeCluster"},
{"name": "CommunityStructure"},
{"name": "HierarchicalCluster"},
{"name": "MergeEdge"}
]
}]
},
{
"name": "graph",
"children": [
{"name": "BetweennessCentrality"},
{"name": "LinkDistance"},
{"name": "MaxFlowMinCut"},
{"name": "ShortestPaths"},
{"name": "SpanningTree"}
]
}
]
}
見http://stackoverflow.com/questions/18983185/how-to-create-correct-jsonarray-in-java-獲得實例使用-jsonobject – stepanian
這是不是很清楚你的問題是什麼。請將您的代碼作爲一個[最小示例](http://stackoverflow.com/help/mcve)來演示您的問題。 –
@Duncan:我想他想用Java代碼創建JSON結構。 – stepanian