I have the following json object and I wanted to get the desired output like below.
var testdata = [{
        "x": [
            "Jan-10",
            "Feb-10",
            "Mar-10",
            "Apr-10",
            "May-10"
        ],
        "y": [
            "100.0",
            "25.0",
            "100.0",
            "60.0",
            "500.0"
        ],
        "xf": "Jan-10",
        "xl": "May-10",
        "yf": "100.0",
        "yl": "500.0",
        "xtitle": "day",
        "ytitle": "rs"
    },
    {
        "x": [
            "Jan-11",
            "Feb-11",
            "Mar-11",
            "Apr-11",
            "May-11"
        ],
        "y": [
            "450.0",
            "650.0",
            "300.0",
            "70.0",
            "360.0"
        ],
        "xf": "Jan-11",
        "xl": "May-11",
        "yf": "450.0",
        "yl": "360.0",
        "xtitle": "day",
        "ytitle": "rs"
    }
];
I wanted to iterate this and should get the similar output like this(y1 and y2 are nothing but their values, those keys can be anything):
[{
        "day": "Jan",
        "y1": "100",
        "y2": "450"
    },
    {
        "day": "Feb",
        "y1": "25",
        "y2": "650"
    },
    {
        "day": "Mar",
        "y1": "100",
        "y2": "300"
    },
    {
        "day": "Apr",
        "y1": "60",
        "y2": "70"
    },
    {
        "day": "May",
        "y1": "500",
        "y2": "360"
    }
]
I have tried like:
if(testdata.length > 0){
         var outarr = [];
          for(var i = 0; i < testdata[0].x.length; i++) {
            outarr.push(
            {
            "x": testdata[0].x[i],
            "y": testdata[0].y[i]
            })
            }
        console.log(JSON.stringify(outarr));
}
but I am not getting from the above looping to get the actual output, please let me know how to do this to get my similar output. Created Fiddle. Thanks in advance !
 
    