Transform array objects in fields

hi,

I have a object like this:

"fields": [
{
"value": "123",
"id": "0"
},
{
"value": "456",
"id": "1"
},
{
"value": "llllobj",
"id": "2"
}
]

but i want change the id to a field in my object like this:
"fields": {
"0": "123",
"1": "456",
"2": "llllobj"
}
it´s possible? What is the most appropriate filter for this?

None of the standard filters can do exactly this but you can write some code in a ruby filter. This should be close to what you want:

event.get('fields').each { |kvpair|
  event.set(kvpair['id'], kvpair['value'])
}

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.