Katie

Katie

  • 1.2k
  • 231
  • 1.7k

Transform object for UI

Dec 28 2023 10:28 PM

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)