我是node.JS的新手,目前正在開發一個小型項目。 問題陳述:我想獲取「窗口」的值,但想要隱藏「窗口」鍵。 Node.js中有這種方法嗎?Node.js中的JSON對象內的JSON對象
輸入JSON:
{
"widget": {
"debug": {
"window": {
"image": [
{
"src": "Images/Sun.png",
"name": "sun1",
"hOffset": 250,
"vOffset": 250,
"alignment": "center"
},
{
"src": "Images/Moon.png",
"name": "moon1",
"hOffset": 250,
"vOffset": 250,
"alignment": "center"
}
]
}
}
}
}
輸出JSON:
{
"widget": {
"debug": {
"image": [
{
"src": "Images/Sun.png",
"name": "sun1",
"hOffset": 250,
"vOffset": 250,
"alignment": "center"
},
{
"src": "Images/Moon.png",
"name": "moon1",
"hOffset": 250,
"vOffset": 250,
"alignment": "center"
}
]
}
}
}
「hide」是什麼意思? –
@Kevin B我不想要「窗口」,即在輸出JSON中看到的關鍵。只有它的值必須被顯示。 –
換句話說,您想要移除'widget.debug.window',並在'widget.debug'上存儲'widget.debug.window.image'鍵/值對。 –