I have a JSON like this,
{
"entry": [
{
"resource": {
"id": "car-1",
"type": "vehicle",
"color": "red",
"owner": {
"ref": "Person/person-1"
}
}
},
{
"resource": {
"id": "car-2",
"type": "vehicle",
"color": "blue",
"owner": {
"ref": "Person/person-2"
}
}
},
{
"resource": {
"id": "person-1",
"type": "Person",
"name": "john"
}
},
{
"resource": {
"id": "person-2",
"type": "Person",
"name": "wick"
}
}
]
}
and want to transform it to something like this.
[
{
"id": "car-1",
"type": "vehicle",
"color": "red",
"ownername": "john"
},
{
"id": "car-2",
"type": "vehicle",
"color": "blue",
"ownername": "wick"
}
]
The < resource/owner/ref >
-> < type/id >
: For each car the owner name to be added into the JSON.
I tried various combinations but unable to do it.
Any help would be greatly appreciated.