I am trying to convert the sample input below into the output below using jq:
Input JSON
"elements": [
{
"type": "CustomObjectData",
"id": "2185",
"fieldValues": [
{
"type": "FieldValue",
"id": "169",
"value": "9/6/2017 12:00:00 AM"
},
{
"type": "FieldValue",
"id": "190",
"value": "ABC"
}
]
},
{
"type": "CustomObjectData",
"id": "2186",
"contactId": "13",
"fieldValues": [
{
"type": "FieldValue",
"id": "169",
"value": "8/31/2017 12:00:00 AM"
},
{
"type": "FieldValue",
"id": "190",
"value": "DEF"
}
]
}
]
Desired Output (group by id)
Essentially trying to extract "value" field from each "fieldValues" object and group them by "id"
{
"id:"2185",
"value": "9/6/2017 12:00:00 AM",
"value": "ABC"
},
{
"id:"2186",
"value": "8/31/2017 12:00:00 AM",
"value": "DEF"
}
What jq syntax should i use to achieve this? Thanks very much!!