-1

我有以下格式的 Json 数据...

var oData = [
{           
    "0":
    {
        "firstname": "aaa",
        "lastname": "zzz",
         "Email": "aaa@test.com"
    },

    "1":
    {
        "firstname": "bbb",
        "lastname": "yyy",
        "Email": "bbb@test.com"
    },

    "2":
    {
        "firstname": "ccc",
        "lastname": "www",
        "Email": "ccc@test.com"
    }

}];

我们可以转换成以下格式吗??

var rData = [              
    {
        "firstname": "aaa",
        "lastname": "zzz",
        "Email": "aaa@test.com"
    },

    {
        "firstname": "bbb",
        "lastname": "yyy",
        "Email": "bbb@test.com"
    },

    {
        "firstname": "ccc",
        "lastname": "www",
        "Email": "ccc@test.com"
    }];
4

1 回答 1

1
    var oData = [{           
        "0":
        {
            "firstname": "aaa",
            "lastname": "zzz",
             "Email": "aaa@test.com"
        },

        "1":
        {
            "firstname": "bbb",
            "lastname": "yyy",
            "Email": "bbb@test.com"
        },

        "2":
        {
            "firstname": "ccc",
            "lastname": "www",
            "Email": "ccc@test.com"
        }

    }],
    data = oData[0],
    rData = [];
JSON.stringify( data, function( key, value ) {
    rData.push( value );
});
console.log( rData );
于 2013-09-19T14:46:53.997 回答