Convert to hash before json

This is causing an error with oj converting directly from a struct to json