I have a collection of JavaScript dictionaries that look like
my_dictionary = [
{"first_thing": "1"},
{"second_thing": "2"}
]
, but which need to look like
my_dictionary = [
{key: "first_thing", value: "1"},
{key: "second_thing", value: "2"}
]
. Since there are so many of these dictionaries, I need a way to iterate through them and change all of the dictionaries so that they will have they key and value inside.
I have tried iterating through, and tried selecting them using something like my_dictionary[0].key as well as my_dictionary[0][0], which I hoped would work, but I suppose that isn’t the way to do it.
{ first_thing: 1, second_thing: 2}? Why this array of single-property objects?