Javascript 从对象中删除额外的层

Javascript 从对象中删除额外的层,javascript,Javascript,我有一些web钩子,可以返回下一个数据: "data": { "object": { "id": "cus_JYmRConwwwbDjw", "object": "customer", "address": null, "balance": 0, "creat

我有一些web钩子,可以返回下一个数据:

 "data": {
    "object": {
      "id": "cus_JYmRConwwwbDjw",
      "object": "customer",
      "address": null,
      "balance": 0,
      "created": 1622105261,
      "currency": null,
      "default_source": null,
      "delinquent": false,
      "description": null,
      "discount": null,
      "email": null,
      "invoice_prefix": "7BA9446D",
      "invoice_settings": {
        "custom_fields": null,
        "default_payment_method": "pm_1Ivesgeee6awlUaOWjDDzmv",
        "footer": null
      },
      "livemode": false,
      "metadata": {},
      "name": null,
      "next_invoice_sequence": 1,
      "phone": null,
      "preferred_locales": [],
      "shipping": null,
      "sources": {
        "object": "list",
        "data": [],
        "has_more": false,
        "total_count": 0,
        "url": "/v1/customers/cus_JYmRCewwea5bDjw/sources"
      },
      "subscriptions": {
        "object": "list",
        "data": [],
        "has_more": false,
        "total_count": 0,
        "url": "/v1/customers/cus_JYmewenGa5bDjw/subscriptions"
      },
      "tax_exempt": "none",
      "tax_ids": {
        "object": "list",
        "data": [],
        "has_more": false,
        "total_count": 0,
        "url": "/v1/customers/cus_JYmRCowea5bDjw/tax_ids"
      },
      "tax_info": null,
      "tax_info_verification": null
    },
    "previous_attributes": {
      "invoice_settings": {
        "default_payment_method": null
      }
    }
  },
  "type": "customer.updated"
}
要访问例如id我需要使用下一个路径data.object.id。 如何避免在路径中使用此不可读、不需要的对象项?
我需要的是data.id

data=data.object
?它是一个web钩子,返回数据,所以
对象
键在
数据
对象中总是会出现,所以您必须像
data.object.id