Coerce data type to JSON