JSON 反规范化需要 Jolt 规范
Jolt Spec needed for JSON denormalization
我有以下格式的 json(不仅限于本例中的两个文档,可能还有很多很多):
[{
"ownerId": "XTV7I728",
"vehicleId": "999",
"engineId": "1",
"engineName": "Standard Engine",
"engineHp": 300
},
{
"ownerId": "XTV7I728",
"vehicleId": "999",
"engineId": "2",
"engineName": "Custom Engine",
"engineHp": 450
}]
我想基本上 "denormalize" 多个这样的 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 的有限理解使我相信这种转变是可能的,但目前还不清楚如何从提供的文档中进行转换。非常感谢任何有关 Jolt 规范的帮助!!
问题被重复发布。
我有以下格式的 json(不仅限于本例中的两个文档,可能还有很多很多):
[{
"ownerId": "XTV7I728",
"vehicleId": "999",
"engineId": "1",
"engineName": "Standard Engine",
"engineHp": 300
},
{
"ownerId": "XTV7I728",
"vehicleId": "999",
"engineId": "2",
"engineName": "Custom Engine",
"engineHp": 450
}]
我想基本上 "denormalize" 多个这样的 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 的有限理解使我相信这种转变是可能的,但目前还不清楚如何从提供的文档中进行转换。非常感谢任何有关 Jolt 规范的帮助!!
问题被重复发布。