I have this code and I need to get the keys and the values of the "filterFeatureGroup" object with JQ.
{
"filterFeatureGroup": {
"Hauttyp": [
"Normal"
],
"Deckkraft": [
"Mittlere Deckkraft"
],
"Grundfarbe": [
"Grau"
],
"Produkteigenschaften": [
"Vegan"
],
"Textur / Konsistenz / Applikation": [
"Stift"
]
}
}
My desired output is:
["Hauttyp: Normal", "Deckkraft: Grau", "Produkteigenschaften: Vegan"]
I have tried to put together the keys[] and values[] of the object but then I ended up with multiplying the elements in the output.
jq ".filterFeatureGroup| (keys[]| split(",")) + (values[])| join(": ")"
Would anyone be able to help?
>Solution :
I have tried to put together the keys[] and values[] of the object
Use to_entries for that
.filterFeatureGroup | to_entries | map("\(.key): \(.value[0])")