Javascript 从nodejs中的JsonObject中获取对象数组?

Javascript 从nodejs中的JsonObject中获取对象数组?,javascript,node.js,json,loopback,Javascript,Node.js,Json,Loopback,我想使用node.js中的连接从多个表中获取数据。我已经写了这个查询 Report.find({ where: {id: data}, include: { relation: 'reportSections', scope: { 'fields': ['id', 'reportId', 'sectionId'], include: { relation: 'section', scope: {

我想使用node.js中的连接从多个表中获取数据。我已经写了这个查询

    Report.find({
  where: {id: data},
  include: {
    relation: 'reportSections',
    scope: {
      'fields': ['id', 'reportId', 'sectionId'],
      include: {
        relation: 'section',
        scope: {
          include: {
            relation: 'sectionFields',
            scope: {
              include: [{relation: 'reportMeta'},
                {relation: 'fields'}],
            },
          },
        },
      },
    },
  },
}, function(err, response) {

  console.log(response[0]);
  cb(null, Object.keys(response[0]));
});
作为这个查询的结果,我得到了这个响应

[
      {
        "Name": "Dalton Patron",
        "id": 1,
        "reportSections": [
          {
            "id": 1,
            "sectionId": 1,
            "reportId": 1,
            "section": {
              "label": "Personal Details",
              "id": 1,
              "sectionFields": [
                {
                  "label": "First Name",
                  "id": 1,
                  "sectionId": 1,
                  "fieldsId": 1,
                  "fields": {
                    "Type": "Text Field ",
                    "id": 1
                  },
                  "reportMeta": [
                    {
                      "Value": "Muhammad Naeem AKhtar",
                      "id": 1,
                      "sectionFieldId": 1
                    },
                    {
                      "Value": "sss",
                      "id": 2,
                      "sectionFieldId": 1
                    }
                  ]
                },
                {
                  "label": "Second Name",
                  "id": 2,
                  "sectionId": 1,
                  "fieldsId": 1,
                  "fields": {
                    "Type": "Text Field ",
                    "id": 1
                  },
                  "reportMeta": []
                }
              ]
            }
          }
        ]
      }
    ]
我想让每个对象分别出现在上面的json中。我在这里面临的问题是,如果我想在单独的变量中获得Name和Id属性,我可以成功地获得它,但我无法获得reportsections数组。您能告诉我如何使用Node获得它吗

如果我使用以下方法获取对象关键点:-

Object.keys(response[0]
它正在返回:

[
  "__cachedRelations",
  "__data",
  "__dataSource",
  "__strict",
  "__persisted"
]

请有人告诉我在node js中的解决方案。谢谢

如果
Object.keys
返回该数组,那么
response
不是您发布的内容。它可能是您正在使用的某个工具的包装器对象。您的实际响应是什么?通常在node.js中,response.body会给出所需的结果。实际上,如果我从客户端调用api,我会得到上面提到的响应,但在我的api中,我无法访问传递给此响应的属性。什么是
console.log(response)
give then?看起来您有一个保存响应数据的包装器对象。响应数据可能位于
\u data
中,该数据可能具有get函数。