Fixes encoding of JSON data.