|
在之前的文章中我們講到了早期的集中數(shù)據(jù)格式,XML,SOAP,HTML?,F(xiàn)在,我們來看看JSON和JSONP。
JSON
JSON(JavaScript Object Notation)是Douglas Crockford提出的。他是一個(gè)輕量級的數(shù)據(jù)交換格式,基于JavaScript對象字面量。
我們可以將之前的XML圖書格式的文件內(nèi)容轉(zhuǎn)換成下面的JSON格式:
[
{
title: "The Principles of Beautiful Web Design, 2nd Edition",
url: "http://www.sitepoint.com/books/design2/",
author: "Jason Beaird",
publisher: "SitePoint",
price: {
currency: "USD",
amount: 39.95
}
},
{
title: "jQuery: Novice to Ninja",
url: "http://www.sitepoint.com/books/jquery1/",
author: "JEarle Castledine & Craig Sharkie",
publisher: "SitePoint",
price: {
currency: "USD",
amount: 29.95
}
},
{
title: "Build Your Own Database Driven Website",
url: "http://www.sitepoint.com/books/phpmysql4/",
author: "Kevin Yank",
publisher: "SitePoint",
price: {
currency: "USD",
amount: 39.95
}
}
]
it知識(shí)庫:Ajax和WEB服務(wù)數(shù)據(jù)格式:JSON與JSONP,轉(zhuǎn)載需保留來源!
鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請第一時(shí)間聯(lián)系我們修改或刪除,多謝。