颠簸 JSON 变换
Jolt JSON transformation
我要改造这个JSON:
{
"_id": "6218e53465793fa20ea11524",
"patientorderitems": [
{
"poi_id": "6218e53465793fa20ea1152a",
"patientorderlogs": [
{
"pol_id": "6218e53465793fa20ea1152e",
"useruid": "61ee4995f16eebb6b7e1c644",
"modifiedat": "2022-02-25T17:18:28Z"
},
{
"pol_id": "6218e53465793fa20ea1152c",
"useruid": "61ee4995f16eebb6b7e1c643",
"modifiedat": "2022-02-25T17:18:28Z"
}
]
},
{
"poi_id": "6218e53465793fa20ea11525",
"patientorderlogs": [
{
"pol_id": "6218e53465793fa20ea11529",
"useruid": "61ee4995f16eebb6b7e1c644",
"modifiedat": "2022-02-25T17:18:28Z"
}
]
}
]
}
对此JSON:
[
{
"_id": "6218e53465793fa20ea11524",
"poi_id": "6218e53465793fa20ea1152a",
"pol_id": "6218e53465793fa20ea1152e",
"useruid": "61ee4995f16eebb6b7e1c644",
"modifiedat": "2022-02-25T17:18:28Z"
},
{
"_id": "6218e53465793fa20ea11524",
"poi_id": "6218e53465793fa20ea1152a",
"pol_id": "6218e53465793fa20ea1152c",
"useruid": "61ee4995f16eebb6b7e1c643",
"modifiedat": "2022-02-25T17:18:28Z"
},
{
"_id": "6218e53465793fa20ea11524",
"poi_id": "6218e53465793fa20ea11525",
"pol_id": "6218e53465793fa20ea11529",
"useruid": "61ee4995f16eebb6b7e1c644",
"modifiedat": "2022-02-25T17:18:28Z"
}
]
我目前正在使用这个规范,它对我不起作用:
[
{
"operation": "shift",
"spec": {
"patientorderitems": {
"*": {
"patientorderlogs": {
"*": {
"@(4,_id)": "[&3]._id",
"@(2,poi_id)": "[&3].poi_id",
"pol_id": "[&3].pol_id",
"useruid": "[&3].useruid",
"modifiedat": "[&3].modifiedat"
}
}
}
}
}
}
]
谁能给出一个规格说明
是否有关于 jolt JSON
的明确文档
................................................ .........................
..................................................... ..........
需要多一层节点。为此,您可以在最内层属性的所有值前加上 &1.
.
然后添加额外的移位转换以删除不需要的键名称和方括号包裹对象。
因此,您可以使用以下规格:
[
{
"operation": "shift",
"spec": {
"patientorderitems": {
"*": {
"patientorderlogs": {
"*": {
"@(4,_id)": "&1.[&3]._id",
"@(2,poi_id)": "&1.[&3].poi_id",
"*": "&1.[&3].&" // combine all innermost attributes by "*" wildcard
}
}
}
}
}
},
{
//get rid of indexes and wrapper brackets
"operation": "shift",
"spec": {
"*": {
"*": ""
}
}
}
]
网站上的演示http://jolt-demo.appspot.com/
我要改造这个JSON:
{
"_id": "6218e53465793fa20ea11524",
"patientorderitems": [
{
"poi_id": "6218e53465793fa20ea1152a",
"patientorderlogs": [
{
"pol_id": "6218e53465793fa20ea1152e",
"useruid": "61ee4995f16eebb6b7e1c644",
"modifiedat": "2022-02-25T17:18:28Z"
},
{
"pol_id": "6218e53465793fa20ea1152c",
"useruid": "61ee4995f16eebb6b7e1c643",
"modifiedat": "2022-02-25T17:18:28Z"
}
]
},
{
"poi_id": "6218e53465793fa20ea11525",
"patientorderlogs": [
{
"pol_id": "6218e53465793fa20ea11529",
"useruid": "61ee4995f16eebb6b7e1c644",
"modifiedat": "2022-02-25T17:18:28Z"
}
]
}
]
}
对此JSON:
[
{
"_id": "6218e53465793fa20ea11524",
"poi_id": "6218e53465793fa20ea1152a",
"pol_id": "6218e53465793fa20ea1152e",
"useruid": "61ee4995f16eebb6b7e1c644",
"modifiedat": "2022-02-25T17:18:28Z"
},
{
"_id": "6218e53465793fa20ea11524",
"poi_id": "6218e53465793fa20ea1152a",
"pol_id": "6218e53465793fa20ea1152c",
"useruid": "61ee4995f16eebb6b7e1c643",
"modifiedat": "2022-02-25T17:18:28Z"
},
{
"_id": "6218e53465793fa20ea11524",
"poi_id": "6218e53465793fa20ea11525",
"pol_id": "6218e53465793fa20ea11529",
"useruid": "61ee4995f16eebb6b7e1c644",
"modifiedat": "2022-02-25T17:18:28Z"
}
]
我目前正在使用这个规范,它对我不起作用:
[
{
"operation": "shift",
"spec": {
"patientorderitems": {
"*": {
"patientorderlogs": {
"*": {
"@(4,_id)": "[&3]._id",
"@(2,poi_id)": "[&3].poi_id",
"pol_id": "[&3].pol_id",
"useruid": "[&3].useruid",
"modifiedat": "[&3].modifiedat"
}
}
}
}
}
}
]
谁能给出一个规格说明 是否有关于 jolt JSON
的明确文档................................................ ......................... ..................................................... ..........
需要多一层节点。为此,您可以在最内层属性的所有值前加上 &1.
.
然后添加额外的移位转换以删除不需要的键名称和方括号包裹对象。
因此,您可以使用以下规格:
[
{
"operation": "shift",
"spec": {
"patientorderitems": {
"*": {
"patientorderlogs": {
"*": {
"@(4,_id)": "&1.[&3]._id",
"@(2,poi_id)": "&1.[&3].poi_id",
"*": "&1.[&3].&" // combine all innermost attributes by "*" wildcard
}
}
}
}
}
},
{
//get rid of indexes and wrapper brackets
"operation": "shift",
"spec": {
"*": {
"*": ""
}
}
}
]
网站上的演示http://jolt-demo.appspot.com/