我有一個對象本身和要通過時間對它進行排序(線第一,指向第二)在每一維(簡化JSON):排序多維JSON對象
[{
"type":"point"
},
{
"type":"line",
"children": [
{
"type":"point"
},
{
"type":"point"
},
{
"type":"line"
}
]
},
{
"type":"point"
}]
這漁政可以更深,並有更多的點/線在彼此。
的排序輸出將是這樣的:
[{
"type":"line",
"children": [
{
"type":"line"
},
{
"type":"point"
},
{
"type":"point"
}
]
},
{
"type":"point"
},
{
"type":"point"
}]
感謝
...和?你在哪裏遇到麻煩?你有什麼嘗試? (你是真的用JSON對象來做這件事,或者 - 我認爲這很可能 - Python數組和字典...?) –