Friday, February 15, 2019

Jackson ObjectMapper: Unexpected character: was expecting double-quote to start field name

If you are running into the following error message, you need to configure your ObjectMapper to allow for unquoted field names. You can accomplish this in a single line:

mapper.configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true);

Here's a full example of the code:

import org.codehaus.jackson.JsonParser;

public class Example {
    public static void main(String[] args) {
       ObjectMapper mapper = new ObjectMapper();
       mapper.configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true);

1 comment:

  1. NcAA College basketball live stream free online. How to watch NCAA Men's basketball games live stream & Find NcAAB schedule, TV channel, news updates online. #NCAA #NCAABasketball #CollegeBasketball

    NCAA Basketball live
    College Basketball live