使用 jolt 仅提取需要的 JSON 数据
Pulling out only required JSON data using jolt
我很难用 jolt 转换我的 JSON。这是我的 JSON:
{
"totalPages":105,
"firstPage":true,
"lastPage":false,
"numberOfElements":5,
"number":0,
"totalElements":524,
"columns":{
"dimension":{
"id":"variables/evar134",
"type":"string"
},
"columnIds":[
"0",
"1",
"2",
"3",
"5",
"6"
]
},
"rows":[
{
"itemId":"938410065",
"value":"1131568",
"data":[
1.0,
523.0,
0.0,
"NaN",
0.0,
1.0002442201269182
]
},
{
"itemId":"2011836789",
"value":"196149",
"data":[
1.0,
523.0,
0.0,
"NaN",
0.0,
1.0002442201269182
]
},
{
"itemId":"1400165844",
"value":"1258290",
"data":[
1.0,
523.0,
0.0,
"NaN",
0.0,
1.0002442201269182
]
},
{
"itemId":"4260137693",
"value":"1382641",
"data":[
1.0,
523.0,
0.0,
"NaN",
1.0002442201269182,
0.0
]
},
{
"itemId":"4117340671",
"value":"941349",
"data":[
1.0,
523.0,
0.0,
"NaN",
1.0002442201269182,
0.0
]
}
],
"summaryData":{
"totals":[
570.0,
523.0,
506.0,
0.9940711462450593,
482.6580757318888,
35.30252394415497
],
"col-max":[
33.0,
523.0,
2.0,
1.0,
1.0002442201269182,
1.0002442201269182
],
"col-min":[
1.0,
523.0,
1.0,
1.0,
1.0002442201269182,
1.0002442201269182
]
}
}
我想做的就是提取所有 "value" 数据。例如:
{
"value":"1131568",
},
{
"value":"196149",
}...
我以为震动看起来像这样,以拉出每个实例:
[
{
"operation": "shift",
"spec": {
"*": {
"value": "value"
}
}
}
]
然而,当我在 jolt validator 上尝试这个时,它说它无效。
有人可以帮助我了解如何执行此操作吗?
[
{
"operation": "shift",
"spec": {
"rows": { // here I add key where nested values can be found
"*": {
"value": "[&1].value" // without [&1] all values will be written to the same key
}
}
}
}
]
我很难用 jolt 转换我的 JSON。这是我的 JSON:
{
"totalPages":105,
"firstPage":true,
"lastPage":false,
"numberOfElements":5,
"number":0,
"totalElements":524,
"columns":{
"dimension":{
"id":"variables/evar134",
"type":"string"
},
"columnIds":[
"0",
"1",
"2",
"3",
"5",
"6"
]
},
"rows":[
{
"itemId":"938410065",
"value":"1131568",
"data":[
1.0,
523.0,
0.0,
"NaN",
0.0,
1.0002442201269182
]
},
{
"itemId":"2011836789",
"value":"196149",
"data":[
1.0,
523.0,
0.0,
"NaN",
0.0,
1.0002442201269182
]
},
{
"itemId":"1400165844",
"value":"1258290",
"data":[
1.0,
523.0,
0.0,
"NaN",
0.0,
1.0002442201269182
]
},
{
"itemId":"4260137693",
"value":"1382641",
"data":[
1.0,
523.0,
0.0,
"NaN",
1.0002442201269182,
0.0
]
},
{
"itemId":"4117340671",
"value":"941349",
"data":[
1.0,
523.0,
0.0,
"NaN",
1.0002442201269182,
0.0
]
}
],
"summaryData":{
"totals":[
570.0,
523.0,
506.0,
0.9940711462450593,
482.6580757318888,
35.30252394415497
],
"col-max":[
33.0,
523.0,
2.0,
1.0,
1.0002442201269182,
1.0002442201269182
],
"col-min":[
1.0,
523.0,
1.0,
1.0,
1.0002442201269182,
1.0002442201269182
]
}
}
我想做的就是提取所有 "value" 数据。例如:
{
"value":"1131568",
},
{
"value":"196149",
}...
我以为震动看起来像这样,以拉出每个实例:
[
{
"operation": "shift",
"spec": {
"*": {
"value": "value"
}
}
}
]
然而,当我在 jolt validator 上尝试这个时,它说它无效。
有人可以帮助我了解如何执行此操作吗?
[
{
"operation": "shift",
"spec": {
"rows": { // here I add key where nested values can be found
"*": {
"value": "[&1].value" // without [&1] all values will be written to the same key
}
}
}
}
]