I have just started with reactjs and working on form component(formsy).I am trying to add and element to the existing array element but I am not able to do so. below is what I have tried and what I have got so far.
JSON Object -
{
"details": {
"someInnerObj": "v3",
"innerObj": {
"key1": "",
"key2": ""
},
"ArrayObject": [{
"type": "sometype",
"somedesign": {
"A": "",
"B": "",
"C": "",
"D": ""
},
"somedev": {
"a": "",
"b": "",
"c": "",
"d": ""
}
}
],
"code": "code",
"isThis": "true"
}
}
what i am trying to achieve here is adding and element to ArrayObject like below
"ArrayObject": [{
"type": "sometype",
"somedesign": {
"A": "",
"B": "",
"C": "",
"D": ""
},
"somedev": {
"a": "",
"b": "",
"c": "",
"d": ""
}
},
{
"type": "sometype1",
"somedesing1": {
"A1": "",
"B1": "",
"C1": "",
"D1": ""
},
"somedev1": {
"a1": "",
"b1": "",
"c1": "",
"d1": ""
}
}
]
I am putting new element using the field value of json object as "details.ArrayObject[1]". but it instead of adding the new element is creating new key as given below and removing the existing -
"ArrayObject": {
"[1]": {
"type": "sometype1",
"somedesing1": {
"A1": "",
"B1": "",
"C1": "",
"D1": ""
},
"somedev1": {
"a1": "",
"b1": "",
"c1": "",
"d1": ""
}
}
}
Could anyone please help out here ?
thanks.