[英]JSON string array to object array using JOLT
對於學生項目,我必須提高數據質量。 第一步是請求一個API。 其次,我們必須編輯json結構。
這是來自API的響應:
{
"lists": [
[
0,
451,
"test",
"953"
],
[
2,
1010,
"hello",
"610"
]
]
}
現在使用jolt,我想要一個這樣的結果:
{
"lists": [
{
"id": 0,
"clientId": 451,
"name": "test",
"custom_value": "953"
},
{
"id": 2,
"clientId": 1010,
"name": "hello",
"custom_value": "610"
}
]
}
目前,我可以訪問數據值,但是我不知道如何將其分成帶有對象的數組。
我的“代碼”:
[
{
"operation": "shift",
"spec": {
"lists": {
"*": {
"*": {
"*": {
"$0": "lists"
}
}
}
}
}
}
]
我哪里做錯了,如何正確編輯原始數組的結構?
規格
[
{
"operation": "shift",
"spec": {
"lists": {
"*": { // lists array
"0": "lists[&1].id",
"1": "lists[&1].clientId",
"2": "lists[&1].name",
"3": "lists[&1].custom_value"
}
}
}
}
]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.