I want to convert my object status field that is would be modified specifically. I have found the answer but no fill my goal that's why I updated my question
I have objects like this below:
Items = [
{
"id": 9,
"alias": "5cbe5c1c-e36b-422d-beb3-225a8e549bf1",
"name": "sfasf",
"status": 1
},
{
"id": 5,
"alias": "ed8a6921-c2c2-4a49-8893-5bf5c2bc0d98",
"name": "Test",
"status": 2
},
{
"id": 6,
"alias": "ed8a921-c2c2-4a49-8893-5bf5c2bc0d98",
"name": "Test",
"status": 3
}
]
I need to convert my object like below or I need to print like belows:
[
{
"id": 9,
"alias": "5cbe5c1c-e36b-422d-beb3-225a8e549bf1",
"name": "sfasf",
"status": {
"1": "ACTIVE"
}
},
{
"id": 5,
"alias": "ed8a6921-c2c2-4a49-8893-5bf5c2bc0d98",
"name": "Test",
"status": {
"2": "INACTIVE"
}
},
{
"id": 6,
"alias": "ed8a921-c2c2-4a49-8893-5bf5c2bc0d98",
"name": "Test",
"status": {
"3": "DELETED"
}
}
]