Ruby filter to whitelist nested fields

If you need to iterate over the contents of objects in the event then you would use a ruby filter like this. However, it is hard for me to even think of a syntax that would allow one to specify which nested fields should be whitelisted when an object can contain arrays within hashes and hashes within arrays.