【问题标题】:Help with structuring JSON data帮助构建 JSON 数据
【发布时间】:2011-09-03 12:42:40
【问题描述】:

我正在使用以下 xml 结构在我的网站上创建 xml 提要,其中项目部分根据从数据库返回的行数循环多次。

<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>title goes here</title>
        <link>link goes here</link>
        <atom:link href="url goes here" rel="self" type="application/rss+xml" />
        <description>description goes here</description>
        <item>
            <title>title goes here</title>
            <link>url goes here</link>
            <guid>id goes here</guid>
            <pubDate>data goes here</pubDate>
            <description>description goes here</description>
        </item>
    </channel>
</rss>

我现在需要使用jsonp。构造json数据以json形式返回上述数据的最佳方法是什么?

【问题讨论】:

    标签: xml json jsonp


    【解决方案1】:

    这是我的结构:

    {
      "rss": {
        "channels" : [
          { 
            "title" : "title goes here",
            "link": "link goes here",
            "description": "description goes here",
            "items" : [
              {
                "title": "title goes here",
                "link": "url goes here",
                "guid": "id goes here",
                "pubDate": "data goes here",
                "description": "description goes here"
              } ]
         } ]
      }
    }
    

    【讨论】:

      猜你喜欢
      • 2014-02-14
      • 2021-12-03
      • 2010-11-29
      • 2022-07-13
      • 1970-01-01
      • 2020-05-22
      • 1970-01-01
      • 2011-10-05
      • 1970-01-01
      相关资源
      最近更新 更多