Let's say I have a JSON data set in the form:
{ "fruits": {
"apple": {
"color": red,
"size": small
}
"orange": {
"color": orange,
"size": small
}
}
How would I add an extra name data point (using something like JavaScript to parse the data) to each one so that they look like this:
{ "fruits": {
"apple": {
"color": red,
"size": small,
"name": apple
}
"orange": {
"color": orange,
"size": small,
"name": orange
}
}
I know it might seem redundant to have both an id and name value be the name of the fruit but I need this structure for the program I'm working on. Any suggestions?