[英]Help with structuring JSON data
我在我的網站上使用以下 xml 結構 go 創建 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 形式返回上述數據的最佳方法是什么?
這是我將如何構建它:
{
"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"
} ]
} ]
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.