Jolt中Map含有的List转为Map属性

数据

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
{
"position": "122_269_154_298",
"value": [
[
"A",
0.6103852987289429
],
[
"B",
0.5880608558654785
],
[
"C",
0.5793392658233643
]
]
}

结果

1
2
3
4
5
6
7
8
9
{
"position" : "122_269_154_298",
"result0" : "A",
"score0" : 0.6103852987289429,
"result1" : "B",
"score1" : 0.5880608558654785,
"result2" : "C",
"score2" : 0.5793392658233643
}

jolt

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[
{
"operation": "shift",
"spec": {
"position": "position",
"value": {
"*": {
"0": "result&1",
"1": "score&1"
}
}
}
}
]

本文地址: https://github.com/maxzhao-it/blog/post/b2c68450/