Consider the following JSON data:
[{"name": "John", "id": 1},
{"name": "Don", "id": 2},
{"name": "Tom", "id": 3},
{"name": "NewJohn", "id": 1},
{"name": "Tim", "id": 4}]
I'm looking to determine if the key "id" has duplicate values. If duplicates are found, I want to remove the earlier instances of the JSON with the same "id" in order to obtain a modified JSON Array with unique "id" values.
[{"name": "Don", "id": 2},
{"name": "Tom", "id": 3},
{"name": "NewJohn", "id": 1},
{"name": "Tim", "id": 4}]
Is there a JavaScript solution for achieving this?