I get a JSON array in jquery and now I want to convert this array json data to specific JSON data. I use a arr.push to create this json. Now I want to change this format:
[
{
"question": {
"QuestionType": "QShortText",
"Question": "What's your name?",
"PlaceHolderText": "Placeholder",
"IsNumericOnly": true,
"CharacterLimit": 0,
"IsRequired": true
}
},
{
"Paragraph": {
"QuestionType": "QPargraphText",
"Question": "789",
"PlaceHolderText": "ytut",
"CharacterLimit": 0,
"IsRequired": true
}
}
]
Into this format:
{
"question": {
"QuestionType": "QShortText",
"Question": "What's your name?",
"PlaceHolderText": "Placeholder",
"IsNumericOnly": true,
"CharacterLimit": 0,
"IsRequired": true
},
"Paragraph": {
"QuestionType": "QPargraphText",
"Question": "789",
"PlaceHolderText": "ytut",
"CharacterLimit": 0,
"IsRequired": true
},
}
I have tried doing this:
arrayJsonModel.push({ question: arrayJson[0] })