JSFiddle - React, Tailwind, and code Playground
by Marco Iamonte
JavaScript
var json = {
"prices" : [
{
"market_hash_name" : "★ Bayonet",
"price" : 141.04,
"created_at" : 1455877920
},
{
"market_hash_name" : "AWP | Pit Viper (Minimal Wear)",
"price" : "1.83",
"created_at" : 1455878005
},
{
"market_hash_name" : "Souvenir AWP | Pit Viper (Minimal Wear)",
"price" : "1.83",
"created_at" : 1455878005
}
]
};
var res = {
"prices": []
};
$.each(json.prices, function(i, e) {
var exists = false;
$.each(res.prices, function (c, f){
console.log(f.market_hash_name + " <> " + e.market_hash_name);
console.log(f.market_hash_name == e.market_hash_name);
if (("Souvenir " + f.market_hash_name) == e.market_hash_name) {
exists = true;
}
});
!exists && res.prices.push(e);
});
console.log(res);