Was wondering how to combine similar json keys together to eliminate redundant data. In other words, how do you concatenate values that are similar under the same key rather than having duplicated data? I currently have json data looking like this:
[
{
"listing_id": 1,
"furniture_id": 2,
"price": 129.99,
"duration": null,
"photo_id": 1,
"url": "http://d3otkl9byfilk1.cloudfront.net/images/COHG3---A_Graceland-Silver-With-Malva-Blue-Grey-Contrast"
},
{
"listing_id": 1,
"furniture_id": 2,
"price": 129.99,
"duration": null,
"photo_id": 2,
"url": "https://www.responsive-checkout.com/demo/media/catalog/product/cache/1/image/9df78eab33525d08d6e5fb8d27136e95/c/o/couch.jpg"
}
]
How can I combine the redundant keys to make it look like this:
[
{
"listing_id": 1,
"furniture_id": 2,
"price": 129.99,
"duration": null,
"photo_id": 1,
"url": [{"http://d3otkl9byfilk1.cloudfront.net/images/COHG3---A_Graceland-Silver-With-Malva-Blue-Grey-Contrast", "https://www.responsive-checkout.com/demo/media/catalog/product/cache/1/image/9df78eab33525d08d6e5fb8d27136e95/c/o/couch.jpg"}]
}
]
lodash! Checkout one of my last questions: stackoverflow.com/questions/36928983/…