{"SubmitBy":"SK", "Students[0].name":"Jhon", "Students[0].age":"15", "Students[1].name":"Sam", "Students[1].age":"16", "Students[2].name":"Tom", "Students[2].age":15}
Result expecting like this
{SubmitBy:"SK", Students:[{name:"Jhon", age:"15"},{name:"Sam", age:"16"},{name:"Tom", age:"15"} ]}
3
Answers
You can use library like
dot-prop
to achieve this, code below:To parse an object with array index to an object array with key-value pairs in JavaScript, you can use the following function: