如何解决帮助构造JSON数据
| 我正在使用以下xml结构在我的网站上创建xml提要,其中item部分根据从数据库返回的行数进行了多次循环。<?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形式返回上述数据的最佳方法是什么?
解决方法
这是我的结构方式:
{
\"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\"
} ]
} ]
}
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。