jquery语法 - " [["和" [{"

时间:2015-05-11 21:02:25

标签: json lua jquery-datatables

我有一个jquery表,期望这种格式的数据:

  {
    "draw": 1,
    "recordsTotal": 57,
    "recordsFiltered": 57,
    "data": [
        [
            "Angelica",
            "Ramos",
            "System Architect",
            "London",
            "9th Oct 09",
            "$2,875"
        ],
        [
            "Ashton",
            "Cox",
            "Technical Author",
            "San Francisco",
            "12th Jan 09",
            "$4,800"
        ]
    ]
}

我正在使用lua json库,当它对我的数据进行编码时,我得到以下内容:

{
    "draw": 1,
    "recordsTotal": 57,
    "recordsFiltered": 57,
    "data": [
        {
            "Angelica",
            "Ramos",
            "System Architect",
            "London",
            "9th Oct 09",
            "$2,875"
        },
        {
            "Ashton",
            "Cox",
            "Technical Author",
            "San Francisco",
            "12th Jan 09",
            "$4,800"
        }
    ]
}

唯一的区别在于每个记录使用花括号,而不是方括号。当jquery dataTable看到花括号时,它就会死掉。

我有两个问题: 1.这两者之间的区别是什么? 2.如何使用方括号而不是卷曲来编码数据?

0 个答案:

没有答案