If I have the subsequent JSON array (here are the initial 3 in a set of 100)
var information = [
{
"percent_change_1h": "2.19",
"percent_change_24h": "-1.07",
"percent_change_7d": "-7.2",
},
{
"percent_change_1h": "1.96",
"percent_change_24h": "-2.13",
"percent_change_7d": "-11.64",
},
{
"percent_change_1h": "9.21",
"percent_change_24h": "18.31",
"percent_change_7d": "18.3",
}
]
How do I navigate through this data, and insert an object into each dataset so that afterward it resembles:
var information = [
{
"percent_change_1h": "2.19",
"percent_change_24h": "-1.07",
"percent_change_7d": "-7.2",
"new_key": "newvalue"
},
{
"percent_change_1h": "1.96",
"percent_change_24h": "-2.13",
"percent_change_7d": "-11.64",
"new_key": "newvalue"
},
{
"percent_change_1h": "9.21",
"percent_change_24h": "18.31",
"percent_change_7d": "18.3",
"new_key": "newvalue"
}
]
I have experimented with a for key in information
loop as well as a forEach
method but have not been successful.