cast json values on write to be consistent with reading from the db.

This is analog to what commit 5ac2341fab689344991b2a4817bd2bc8b3edac9d did with hstore fields...

/cc @senny