【问题标题】:Simple Json format when requesting google spreadsheet请求谷歌电子表格时的简单Json格式
【发布时间】:2013-05-14 18:46:06
【问题描述】:

我正在使用 google 电子表格 api 从 javascript 中的 google 表格中读取数据。我需要阅读谷歌表格

我希望结果是这样的:

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 作为 jsonp 以 json 格式请求工作表时:

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

【问题讨论】:

  • 请感谢回答你的人。

标签: javascript json jsonp google-spreadsheet-api


【解决方案1】:

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

【讨论】:

    【解决方案2】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-22
      • 2021-08-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多