2
所以我有一个JSON文件,这基本上是编码成JSON与PHP的Atom XML,每个条目看起来是这样的:从使用jQuery JSON文件获取@属性
{
id: "info:fedora/demo:SmileyBucket/RELS-EXT/2008-07-02T05:09:42.937Z",
title: "RELS-EXT.0",
updated: "2008-07-02T05:09:42.937Z",
category: [
{
@attributes: {
term: "info:fedora/fedora-system:FedoraRELSExt-1.0",
scheme: "info:fedora/fedora-system:def/model#formatURI"
}
},
{
@attributes: {
term: "RDF Statements about this object",
scheme: "info:fedora/fedora-system:def/model#label"
}
},
{
@attributes: {
term: "500",
scheme: "info:fedora/fedora-system:def/model#length"
}
}
],
content: {
@attributes: {
type: "application/rdf+xml"
}
}
},
我可以得到除所有数据@attributes中的东西。 这里是我的jQuery的一个片段:
$("#content-pane").text("ID: " +json.id);
$("#content-pane").append("<br/> Title: " +json.title);
$("#content-pane").append("<br/> Attributes: " +json.entry[5].content.toString());
感谢
太棒了!谢谢,我会接受你的答案,一旦我可以 – QuirijnGB 2012-02-24 15:30:04
是报价是在原始文件,他们消失了,因为铬扩展时复制/粘贴 – QuirijnGB 2012-02-24 15:48:39
没问题,只要确保:) – HackedByChinese 2012-02-24 15:53:13