I have a simple json in which I want to manipulate array structure and data as below , Can anyone suggest How can I do this using javascript or xpaths.
current json :-
{
"pimage": [
{
"limage": "http://images.bestbuy.com/BestBuy_US/images/products/7306/7306011_sb.jpg",
"timage": "http://images.bestbuy.com/BestBuy_US/images/products/7306/7306011_s.gif",
"mimage": "http://images.bestbuy.com/BestBuy_US/images/products/7306/7306011fp.gif",
"lfimage": "http://img.bbystatic.com/BestBuy_US/images/products/7306/7306011_sa.jpg"
}
]
}
expected :- below limage key is made common and urls values from current json is kept as it is.
{
"pimage": [
{
"limage": "http://images.bestbuy.com/BestBuy_US/images/products/7306/7306011_sb.jpg"
},
{
"limage": "http://images.bestbuy.com/BestBuy_US/images/products/7306/7306011_s.gif"
},
{
"limage": "http://images.bestbuy.com/BestBuy_US/images/products/7306/7306011_s.gif"
},
{
"limage": "http://images.bestbuy.com/BestBuy_US/images/products/7306/7306011_s.gif"
}
]
}
'.../7306011_sa.jpg'string?