I have this Json example:
{
"client_id": 15,
"orders": [
{
"order": 110,
"status": "APPROVED",
},
{
"order": 141,
"status": "REJECTED",
}
]
}
I want to generate the result
[
{
"client_id": 15,
"order": 110,
"status": "APPROVED"
},
{
"client_id": 15,
"order": 141,
"status": "REJECTED"
}
]
the current sentence [*].map(&merge({client_id: client_id}, @), orders) returns:
[
{
"client_id": null,
"order": 110,
"status": "APPROVED"
},
{
"client_id": null,
"order": 141,
"status": "REJECTED"
}
]
Why orders values works on second map parameter but client_id not work? And how i can resolve to get the result that i need?