0

I have an object parsed from JSON output.

I have to use only pure JS without any 3rd part libs. Can somebody suggest a working solution to filter a specific nested object by one of its key's value. In this sample I have a few "Fields" objects which contains also nested objects.

So is there a way to filter the whole nested object inside Fields using VName value as a filter criteria? For example use "VName": "oc_data" to filter the whole object inside Fields oc_data belongs to

[{
    "Id": "0050560107dd",
    "Name": "Demo Range",
    "AllMup": false,
    "Lines": [{
        "Id": "0050560107dd",
        "AllMup": false,
        "Fields": [{
          "Id": "0050560107dd",
          "Name": "Some value here",
          "VName": "oc_data",
          "IsRequired": false,
          "Format": {
            "Type": "Dictionary",
            "Dictionary": {
              "Name": "Main stuff",
              "SysName": "da3a45de77d1",
              "ValuesUrl": "https://mysityurl.com",
              "Id": "0050560107dd",
            },
            "CalForm": []
          }
        }]
      },
      {
        "Id": "0050560107dd",
        "AllMup": false,
        "Fields": [{
          "Id": "0050560107dd",
          "Name": "Some value again",
          "VName": "task_stat",
          "IsRequired": false,
          "Format": {
            "Type": "Dictionary",
            "Dictionary": {
              "Name": "Task stuff",
              "SysName": "Tasks.TaskState",
              "ValuesUrl": "https://mysecondurl.com",
              "Id": "ac1f6b17f99d",
            },
            "CalForm": []
          }
        }]
      }
    ]
  },
  {
    "Id": "0050560107dd",
    "Name": "Demo Range",
    "AllMup": false,
    "Lines": [{
      "Id": "0050560107dd",
      "AllMup": false,
      "Fields": [{
        "Id": "0050560107dd",
        "Name": "Category",
        "IsRequired": false,
        "Format": {
          "Type": "Dictionary",
          "Dictionary": {
            "Name": "Some category",
            "SysName": "LitigationCategory",
            "ValuesUrl": "https://myempty.com",
            "Id": "902b343a9588",
          },
          "CalForm": []
        }
      }]
    }]
  }
]

2

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.