json服务器中嵌套对象的问题

时间:2019-04-18 13:06:31

标签: typescript angular6 json-server

我在Angular 6项目的JSON服务器上具有以下对象,并且我想进行crud调用。

我需要能够通过id删除“ examsToBeDone”的内容,但是我无法弄清楚如何获得正确的链接来使此呼叫停止。 我需要保持这种结构,因为检查必须与患者一起进行。非常感谢您的帮助。

{
  "patients": [
    {
      "firstName": "pietro",
      "lastName": "rocchinini",
      "age": "60",
      "id": 6,
      "examsCarriedOut": [
        {
          "id": 1,
          "name": "esame del sangue"
        }
      ],
      "examsToBeDone": [
        {
          "id": 6,
          "name": "controllo vitamina c"
        }
      ]
    },
    {
      "firstName": "pietro",
      "lastName": "giovannini",
      "age": 23,
      "id": 8,
      "examsCarriedOut": [],
      "examsToBeDone": []
    },
    {
      "id": 12,
      "age": "72",
      "firstName": "Armando",
      "lastName": "Pastore",
      "examsCarriedOut": [],
      "examsToBeDone": []
    },
    {
      "id": 13,
      "age": "33",
      "firstName": "Francesco ",
      "lastName": "Renzi",
      "examsCarriedOut": [],
      "examsToBeDone": []
    },
    {
      "id": 14,
      "age": "23",
      "firstName": "fabio",
      "lastName": "forsi",
      "examsCarriedOut": [],
      "examsToBeDone": []
    },
    {
      "id": 15,
      "age": "27",
      "firstName": "roberto",
      "lastName": "crocetta",
      "examsCarriedOut": [],
      "examsToBeDone": [
        {
          "id": 88,
          "name": "esame della tiroide"
        }
      ]
    },
    {
      "id": 16,
      "age": "90",
      "firstName": "mario",
      "lastName": "rossi",
      "examsCarriedOut": [],
      "examsToBeDone": [
        {
          "id": 87,
          "name": "controllo vitamina c"
        }
      ]
    },
    {
      "id": 17,
      "age": "33",
      "firstName": "romualdo",
      "lastName": "pulito"
    },
    {
      "id": 18,
      "age": "33",
      "firstName": "marco",
      "lastName": "luigini"
    },
    {
      "id": 19,
      "age": "29",
      "firstName": "Rosalba",
      "lastName": "Pippa"
    }
  ]
}

0 个答案:

没有答案