Invalid UTF-8 middle byte while Jackson try to Deserialize on service side

Viewed 29

I am having this error when I am trying to call a method on my REST client with values containing special characters.

Object outputJSON //object created from a JOLT transform
JSONObject myObj = new JSONObject(JSONObject.valueToString(outputJSON));
CustomerModel customer = mapper.readValue(myObj.toString(), Customer.class);//mapping with java object runs fine
myCustomerService.updateCustomer(customer);//this is the call throwing exception

The error on the service side :

JSON parse error: Invalid UTF-8 middle byte 0x6e; nested exception is com.fasterxml.jackson.databind.JsonMap pingException: Invalid UTF-8 middle byte 0x6e at [Source: (org.springframework.util.StreamUtils$NonClosingInputStream)

The JSON used to build the request is retrieved from DB and then transformed with JOLT, but I do not know if that's relevant to solve my issue. I do not get why the mapping works fine (readValue does not throw any exception) on client side and throw error on service side.

Am I missing something ?

Thanks

0 Answers
Related