0

我正在尝试发布具有一些硬编码记录的 ext js json 存储。客户和产品之间存在一对多的关系。

{
    "customers": [
        {
            "id": 123,
            "name": "Ed",
            "products": [
                {
                    "id": 50,
                    "prodnm": "xyz",
                     rate:20,
                },
                {
                    "id": 60,
                    "prodnm": "abc",
                     rate:30,
                }                    
            ]
        }
    ]
}

我正在使用 Rails 并想检查我是否得到正确的 json 响应..请帮助..

4

2 回答 2

0

为此,您可以使用此代码从商店获取 json。

function getJsonOfStore(store){
    var datar = new Array();
    var jsonDataEncode = "";
    var records = store.getRange();
    for (var i = 0; i < records.length; i++) {
        datar.push(records[i].data);
    }
    jsonDataEncode = Ext.util.JSON.encode(datar);
    return jsonDataEncode;
}

在控制台中打印该 json,然后复制该 json 并将其粘贴到此处,单击格式它将显示一个格式化的 json。

于 2011-08-25T05:26:17.693 回答
0

检查响应的最佳方法是使用Fiddler

于 2011-06-01T06:24:34.613 回答