I am trying to remove the duplicates from the following json by id
Here is the json:
{
"Result": [
{
"name": "validation-of-art",
"id": "12",
"status": "passed",
"duration": 4740302
},
{
"name": "validation-of-art",
"id": "12",
"status": "passed",
"duration": 272320
},
{
"name": "validation-of-art",
"id": "13",
"status": "passed",
"duration": 272320
}
]
}
Here is what i have tried with:
jq -r 'unique_by(.Result.name)'
and also with jq 'unique_by(.Result[].name)'
I am getting an error - Cannot index array with string "Result"
Any help would be appreciated.