Reputation: 5774
I have a list of elements and want to transfer it to JSON object
[12, 693, 9, 51]
Output result:
[
{
"customer_id": 12
},
{
"customer_id": 693
},
{
"customer_id": 9
},
{
"customer_id": 51
}
]
I tried the following spec but I get null
.
[{
"operation": "shift",
"spec": {
"*": {
"customer_id": "[&1]"
}
}
}]
Upvotes: 0
Views: 33
Reputation: 12083
That will try to match on customer_id rather than generate it in the output. Try this one instead:
[{
"operation": "shift",
"spec": {
"*": "[&0].customer_id"
}
}]
Upvotes: 1