I am working on ReactJS project and have the following JSON data:
[
  {
    "sources": [
      {
        "sourceName": "test_demographics",
        "table": "test_demographics_summary"
      }
    ],
    "userId": "test",
    "queryType": {
      "mixedQuery": false,
      "queryTable": "test_a_query"
    }
  },
  {
    "sources": [
      {
        "sourceName": "something_demographics",
        "table": "something_demographics_summary"
      },
      {
        "sourceName": "something_demographics",
        "table": "something_demographics_summary"
      }
    ],
    "userId": "test",
    "queryType": {
      "mixedQuery": false,
      "queryTable": "test_bquery"
    }
  }
]
I want to extract all the objects in the sources property into one array with deduped data. So essentially for the above JSON data I want an array like so:
[
  {
    "sourceName": "test_demographics",
    "table": "test_demographics_summary"
  },
  {
    "sourceName": "something_demographics",
    "table": "something_demographics_summary"
  }
]
Appreciate any suggestions.


