0
我有以下格式JSON(在這個例子不僅限於兩個文件一樣,那麼可能有很多很多):需要JSON非規範化顛簸規格
[{
"ownerId": "XTV7I728",
"vehicleId": "999",
"engineId": "1",
"engineName": "Standard Engine",
"engineHp": 300
},
{
"ownerId": "XTV7I728",
"vehicleId": "999",
"engineId": "2",
"engineName": "Custom Engine",
"engineHp": 450
}]
我想基本上「非規範化」這些類型的JSON文件的多爲一個JSON文件,如下所示:
[{
"ownerId": "XTV7I728",
"vehicleId": "999",
"engines": [
{
"engineId": "1",
"engineName": "Standard Engine",
"engineHp": 300
},
{
"engineId": "2",
"engineName": "Custom Engine",
"engineHp": 450
}
]
}]
也想補充一點,像
[{
"ownerId": "XTV7I728",
"vehicleId": "999",
"engineId": "1",
"engineName": "Standard Engine",
"engineHp": 300
},
{
"ownerId": "XTV7I728",
"vehicleId": "999",
"engineId": "2",
"engineName": "Custom Engine",
"engineHp": 450
},
{
"ownerId": "TY789021",
"vehicleId": "999",
"engineId": "1",
"engineName": "Standard Engine",
"engineHp": 300
}]
應轉化爲:
[{
"ownerId": "XTV7I728",
"vehicleId": "999",
"engines": [
{
"engineId": "1",
"engineName": "Standard Engine",
"engineHp": 300
},
{
"engineId": "2",
"engineName": "Custom Engine",
"engineHp": 450
}
]
},
{
"ownerId": "TY789021",
"vehicleId": "999",
"engines": [
{
"engineId": "1",
"engineName": "Standard Engine",
"engineHp": 300
}
]
}]
我有限的顛簸的理解至今使我相信,這種轉變是可能的,但它是目前尚不清楚究竟是如何去這從提供的文檔。任何協助與Jolt規格將不勝感激!