在原子结构中获取“@”项

时间:2018-04-06 21:05:23

标签: json xml-parsing atom-feed

我正在尝试遍历原子树以获取特定的项目值:

[
  {"@":{"rel":"mentioned",
        "ostatus:object-type":"http://activitystrea.ms/schema/1.0/collection",
        "href":"http://activityschema.org/collection/public"}},
  {"@":{"rel":"enclosure",
        "type":"image/jpeg",
        "length":"225009",
        "href":"https://framapiaf.org/system/media_attachments/files/000/701/279/original/19ed3ec381293bd8.jpg"}},
  {"@":{"rel":"enclosure",
        "type":"image/jpeg",
        "length":"180205",
        "href":"https://framapiaf.org/system/media_attachments/files/000/701/280/original/101ec4084b0b1920.jpeg"}},
  {"@":{"rel":"enclosure",
        "type":"image/jpeg",
        "length":"257325",
        "href":"https://framapiaf.org/system/media_attachments/files/000/701/281/original/dff3d3dc2e8e1b89.jpg"}},
  {"@":{"rel":"enclosure",
        "type":"image/jpeg",
        "length":"224565",
        "href":"https://framapiaf.org/system/media_attachments/files/000/701/282/original/983f3ad336ebc721.jpg"}},
  {"@":{"rel":"alternate",
        "type":"text/html",
        "href":"https://mastodon.art/@luka/99809176628976105"}}
]

(这是JSON.stringify(item['activity:object'].link)

的输出

但我似乎无法超越那些“@”键;如何访问第一个@.type@.href

0 个答案:

没有答案