JSON响应无法提取变量

JSON响应无法提取变量,json,typescript,react-native,react-native-android,react-native-ios,Json,Typescript,React Native,React Native Android,React Native Ios,全新的反应本机和打字脚本! 很抱歉,提取JSON响应时有点困难。我要提取响应并将其放入一个类中,如下所示 这是申请代码 let notifications: INotification[] notifications = (await Requests.GET('notification/user/test-user-1', accessToken)); 这是上课时间 export interface INotification { id: s

全新的反应本机和打字脚本! 很抱歉,提取JSON响应时有点困难。我要提取响应并将其放入一个类中,如下所示

这是申请代码

    let notifications: INotification[]

    notifications = (await Requests.GET('notification/user/test-user-1', accessToken));
这是上课时间

      export interface INotification {
          id: string;
          senderId: string;
          receiverId: string;
          text: string;
          isSeen: boolean;
          type: string;
          timestamp: string;
      }
这是邮递员的回复

{
    "notifications": [
        {
            "pk": "user-1",
            "sk": "notification1234",
            "entity": "notification",
            "id": "id number",
            "senderId": "test-user-2",
            "receiverId": "test-user-1",
            "text": "Test notifications",
            "isSeen": false,
            "type": 2
        }
    ]
}
下面是控制台的响应

  { notifications: 
       [ { pk: 'user#test-user-1',
           sk: 'notification1234',
           entity: 'notification',
           id: 'id number',
           senderId: 'test-user-2',
           receiverId: 'test-user-1',
           text: 'Test notifications',
           isSeen: false,
           type: 2 } ] 
}
我希望能够写出:

console.log("TEXT: ",notifications[0].text )
并得到响应:“文本:测试通知”


欢迎任何帮助

数据在一个数组中,您需要首先传递数组


console.log(“文本:”,通知[0].TEXT)

你能编辑这个问题吗?添加你目前正在尝试的内容,尝试的结果是什么,它与你想要的有什么不同?嗨!谢谢你的回复。当我运行时,我得到以下信息:undefined不是对象(正在评估“通知[0].text”)