使用JSON API问题的Ionic Data Parse

时间:2017-12-05 01:27:55

标签: php angularjs json cordova ionic-framework

我试图通过在ionWordpress(离子框架插件)中使用JSON来获取数据。

我正在使用JSON API。这是来自我的JSON的数据。

    {
  "status": "ok",
  "count": 6,
  "count_total": 45,
  "pages": 8,
  "posts": [
    {
      "id": 1874,
      "type": "event",
      "slug": "stesets",
      "url": "http://www.web.com/page",
      "status": "publish",
      "title": "setst",
      "title_plain": "tests",
      "content": "testsetstst",
      "excerpt": "testsetststtes",
      "date": "2017-11-27 17:20:17",
      "modified": "2017-11-27 17:20:17",
      "categories": [],
      "tags": [],
      "author": {
        "id": 1,
        "slug": "test",
        "name": "test",
        "first_name": "",
        "last_name": "",
        "nickname": "test",
        "url": "",
        "description": ""
      },
      "comments": [],
      "attachments": [],
      "comment_count": 0,
      "comment_status": "closed",
      "thumbnail": "http://www.website.com/wp-content/uploads/2017/11/image.jpg",

我的问题是当我试图抓取数据时,它也包括[]。例如。

{{post.thumbnail}}

这会显示[" http://www.website.com/wp-content/uploads/2017/11/image.jpg"]

但我只想要链接本身没有[" "]

我该怎么做?

1 个答案:

答案 0 :(得分:0)

我用过:

{{post.thumbnail[0]}}

如Diluk Angelo的评论中所述。