请求谷歌电子表格时的简单Json格式

时间:2013-05-14 18:46:06

标签: javascript json jsonp google-spreadsheet-api

我正在使用谷歌电子表格api从谷歌工作表中读取javascript。我需要阅读谷歌表

我希望结果如下:

result = [ {
        Title : 'Item1',
        Description : 'The items in this list are read dynamically from an external file for now. We can specify the Title, the description and the url of icon image.',
        Icon : 'http://icons.iconarchive.com/icons/dapino/medical/128/medical-suitecase-icon.png'
    },
    {
        Title : 'Item2',
        Description : 'Some Long description to check how the text will appear if it is too long in the info list view. It should wrap automatically and the height of the row should be adjusted as needed. I will add some more worlds.',
        Icon : 'http://icons.iconarchive.com/icons/dapino/summer-holiday/128/compass-icon.png'
    },
    {
        Title : 'Item3',
        Description : 'The pc icon is just a test icon. It can be replaced by any image local or on the server. I just used this one for testing.',
        Icon : 'http://icons.iconarchive.com/icons/gabriel-leblanc/historic-mac/128/ibook-g4-12-icon.png'
    },
    {
        Title : 'Item4',
        Description : 'Adding a final item that will be out of range of the view. You will have to scroll to see it. (at least on the iphone)',
        Icon : 'http://icons.iconarchive.com/icons/double-j-design/ravenna-3d/128/V-Card-icon.png'
    }
];

当我使用此URL将表格作为json请求为jsonp:

我得到了一个非常混乱的Json。有没有办法可以修改网址以返回类似于我想要的内容?或者更简单的东西。我发现很难从返回的Json中提取值

2 个答案:

答案 0 :(得分:0)

您可以使用javascript将返回的json更改为您想要的格式...如果您想要一种无需代码的方式,我很抱歉,但json看起来与GData API输出相同。所以你的选择看起来非常有限。使用上面的json或HTML看起来是最好的选择。

答案 1 :(得分:0)

Tabletop.js和更高级的Sheetsee.js可以有效地完成这项工作。