I have a json string returned from a HTTP GET service that looks like this;
x=[{
"value": 1.37,
"date_transacted": "2015-01-01"
},
{
"value": 1.62,
"date_transacted": "2015-02-01"
},
{
"value": 1.83,
"date_transacted": "2015-03-01"
}]
I want to convert it to something that looks like this;
y=[{
c: [{
v: "2015-01-01"
},
{
v: "1.37"
}]
},
{
c: [{
v: "2015-01-02"
},
{
v: "1.62"
}]
},
{
c: [{
v: "2015-01-03"
},
{
v: "1.83"
}]
}]
How can this be done in javascript?
There is no need to give a complete coding answer as I am not looking to be spoon-fed. Some hints on where to get started will be useful as I am at a loss now.
EDIT: I asked a follow-up question after some preliminary work based on the hints provided by the answer to this question. How do I iterate over this json structure to produce another structure? The answer to this question is over there.