I have a web service returns this data
[
{
"Campaign": "default",
"TotalInBound": 216.0
},
{
"Campaign": "direct",
"TotalInBound": 10.0
},
{
"Campaign": "Sales",
"TotalInBound": 151.0
},
{
"Campaign": "Support",
"TotalInBound": 2.0
}
]
I am using a jquery library which its input is like this:
data = [
{ label: "Product 1", data: Math.floor (Math.random() * 100 + 250) },
{ label: "Product 2", data: Math.floor (Math.random() * 100 + 350) },
{ label: "Product 3", data: Math.floor (Math.random() * 100 + 650) },
{ label: "Product 4", data: Math.floor (Math.random() * 100 + 50) },
{ label: "Product 5", data: Math.floor (Math.random() * 100 + 250) }
];
I want to change my data to that form of data . for example, the final result will be like this:
data = [
{label:"default", data:216.0},
{label:"direct", data:10.0 },
...
...
];
could you help please. i tried to use loops many times, but nothing works.