Json parse

hi
i found somthing that you wrote in discuss
Parse JSON array to flat JSON with filter, or alternative solution

I understood i can not use it like this any more,
can you help me by where to put set and get in this code?

ruby {
code => "
event['contextMap'].each { |kv|
event[kv['key']] = kv['value'] unless kv['value'].nil?
}
"
}