Hello,
I have an JSON array input below:
"coverageStats": [
{
"label": "Branches",
"position": 6,
"total": 30,
"covered": 17,
"isDeltaAvailable": false,
"delta": 0.0
},
{
"label": "Lines",
"position": 4,
"total": 492,
"covered": 117,
"isDeltaAvailable": false,
"delta": 0.0
}
]
and I would like to create something like this with a ruby filter:
Desired output:
"Branches" : {
"label": "Branches"
"position": 6,
"total": 30,
"covered": 17,
"isDeltaAvailable": false,
"delta": 0.0
},
"Lines" : {
"label": "Lines",
"position": 4,
"total": 492,
"covered": 117,
"isDeltaAvailable": false,
"delta": 0.0
}
Basically, I would like to iterate the array and take the "label" value and set it as a key in my new structured dictionary. By doing this, it would make easier to display the event in Kibana.
Any help would be appreciated.
Thank you.