我正在尝试使用JOLT根据属性将标记数组拆分成多个标记。
下面是输入和预期输出
输入json
{
"student": [
{
"student_name": "jone",
"age": 12,
"class": "Seven",
"grade": "first-class"
},
{
"student_name": "jack",
"age": 13,
"class": "Eight",
"grade": "first-class"
},
{
"student_name": "rosy",
"age": 13,
"class": "Eight",
"grade": "second-class"
}
]
}预期输出如下
{
"jone": {
"student_name": "jone",
"age": 12,
"class": "Seven",
"grade": "first-class"
},
"jack": {
"student_name": "jack",
"age": 13,
"class": "Eight",
"grade": "first-class"
},
"rosy": {
"student_name": "rosy",
"age": 13,
"class": "Eight",
"grade": "second-class"
}
}请帮我做一下Jolt变换。提前感谢
发布于 2021-06-12 02:37:30
您可以将嵌套在"student"键中的星号("*")键与"@(1,student_name)" ( or better "@(1,&2_name)" )值一起作为shift变换的最内层元素,以便为各个成员生成索引
[
{
"operation": "shift",
"spec": {
"student": {
"*": {
"@": "@(1,&2_name)"
}
}
}
}
]https://stackoverflow.com/questions/67941437
复制相似问题