Reactjs应用程序中的嵌套JSON结构

时间:2018-12-10 14:28:58

标签: json nested

我想编写一些嵌套的JSON,应该将其返回到 ../ all / page1

此刻../all就像一个超级按钮,但是..all / page1只是返回空的花括号{}。

我正在使用heroku上托管的json服务器。

这是我的db.json:

    {
      "all" :
        [{
          "page1": 
            [{
              "body": "Buy Castor Oil",
              "title": "Oils Of Nature Pure Castor Oil",
              "id": 1
             },
             {
              "title": "Don't Fucking Eat It",
              "body": "Fasting to improve your health or help feed those in 
               need.",
              "id": 2
             },
             {
              "title": "Fyreboz Quiz Bot",
              "body": "Create a quiz playable as a bot in Messenger and/or 
               Slack",
              "id": 3
             }
           ]},
            {
         "page2": 
           [{
             "body": "Buy Castor Oil",
             "title": "Promo Bot",
             "id": 1
            },
            {
             "title": "Golden State Warrior",
             "body": "Fasting to improve your health or help feed those in 
              need.",
             "id": 2
            },
            {
             "title": "Azkarbot",
             "body": "Create a quiz playable as a bot in Messenger and/or 
              Slack",
             "id": 3
            }
          ]}
       }]
    }

您有什么建议,我应该进行哪些更改,以便使用 ../ all / page1 从第1页获取所有数据?

谢谢!

0 个答案:

没有答案