No se si llegue un poco tarde, pero aquí te dejo este pedazo de código que te puede ser utíl.
Código Javascript
:
Ver originalfunction replace(obj) {
var newObj = {};
for(key in obj) {
var newKey = key.split('prod_').join('').split('shop_').join('');
if (typeof(obj[key]) == 'object') {
newObj[newKey]=replace(obj[key]);
} else {
newObj[newKey]=obj[key];
}
}
return newObj;
}
var obj = {
"prod_format": "400 ml",
"prod_brand": "Marca",
"prod_image": "http://192.168.1.45/mini/1046332bb531ab3.jpg",
"prod_name": "Gel de baño o ducha",
"prod_pvp": 2.20,
"prod_shops": [
{
"prod_price": 2.29,
"prod_shop": {
"prod_shopID": 2,
"prod_shop_name": "Tienda",
"prod_shop_image": "http://192.168.1.45/shops/d4d4sw2.jpg"
}
},
{
"prod_price": 2.19,
"prod_shop": {
"prod_shopID": 5,
"prod_shop_name": "Tienda",
"prod_shop_image": "http://192.168.1.45/shops/g4hbe72.jpg"
}
}
]
}
console.log(replace(obj));