私はこのMAPのような地図を持っています:
{
facility-1={
facility-kind1={param1=XPath-1, param2=XPath-2},
facility-kind2={param1=XPath-1, param2=XPath-2},
facility-kind3={param1=XPath-1, param2=XPath-2}
},
facility-2={
facility-kind1={param1=XPath-1, param2=XPath-2},
facility-kind2={param1=XPath-1, param2=XPath-2},
facility-kind3={param1=XPath-1, param2=XPath-2}
}
}
このようにフォーマットされたJSONに変換したい
[
{"title": "Item 1"},
{"title": "Folder 2",
"children": [
{"title": "Sub-item 2.1"},
{"title": "Sub-item 2.2"}
]
},
{"title": "Folder 3",
"children": [
{"title": "Sub-item 3.1"},
{"title": "Sub-item 3.2"}
]
},
{"title": "Item 5"}
]
GSON を使用しようとしましたが、結果の出力は私が望んでいたものではありませんでした:
{
"facility-1": {
"facility-kind1":
{"param1":"XPath-1","param2":"XPath-2"},
"facility-kind2":
{"param1":"XPath-1","param2":"XPath-2"},
"facility-kind3":
{"param1":"XPath-1","param2":"XPath-2"}
},
"facility-2": {
"facility-kind1":
{"param1":"XPath-1","param2":"XPath-2"},
"facility-kind2":
{"param1":"XPath-1","param2":"XPath-2","param3":"XPath-3"},
"facility-kind3":
{"param1":"XPath-1","param2":"XPath-2"}
}
}
必要に応じてフォーマットされたjsonを取得するにはどうすればよいですか??