Convert to hash before json

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