allow flash to be stored as json

@strzalek this code is gross but it will let us move forward until we are on 4.0 where this is fixed properly: https://github.com/rails/rails/commit/654a2de7a9c6d58f98dc9d4596cbeba2e5caeca2