I am attempting to extract the JSON object from an array list
arrayList [
0: {name: "01", value: "3424234234"}
1: {name: "17", value: "26021734"}
2: {name: "10", value: "435345"}
3: {name: "21", value: "3453"}]
The array above has been converted to JSON as shown below
var aiCode = {};
aiCode = Object.assign({}, arrayList );
The current result is displayed below
aiCode
{
0: {name: "01", value: "3424234234"}
1: {name: "17", value: "26021734"}
2: {name: "10", value: "435345"}
3: {name: "21", value: "3453"}
}
However, I require the following format for the result
aiCode:
{
01: "3424234234",
17: "26021734",
10: "435345",
21: "3453"
}
What steps should I take to achieve the desired JSON stringification mentioned above