1
Answer

Transform object for UI

Katie

Katie

1y
494
1

Hello, I have below json coming from API

{
        "id": 1,
        "behaviour": "Attention",
        "operationalDef": "What did I just say? This is definition of Attention",
        "acD1": "aa1",
        "acD2": "aa2",
        "acD3": null,
        "acD4": null,
        "customACD1": null       
    }
]

I would like to convert the same into below form. Basically I want to make a parent object that will contain the values of acD1 to acD4.

{
        "id": 1,
        "behaviour": "Attention",
        "operationalDef": "What did I just say? This is definition of Attention",
        "options" : ["aa1","aa2"],
        "customACD1": null
    }
]

 

Answers (1)