title: How to fix JSON parse error in @requestbody and Enum value?
body: <p>I've two methods:</p>
  <ol>
  <li>&quot;JSON Body&quot; request</li>
  <li>&quot;Form param&quot; request</li>
  </ol>
  <pre class="lang-java prettyprint-override"><code>@RequestMapping(value = &quot;/orders.json&quot;, consumes = { &quot;application/json&quot; }, method = RequestMethod.POST)
  @Override
  public ResponseEntity&lt;Void&gt; createOrder(@Valid @RequestBody OrderCreateDTO orderCreateDTO) {
      return doCreateOrder(orderCreateDTO);
  }
  
  @RequestMapping(value = &quot;/orders.json&quot;, consumes = { &quot;application/x-www-form-urlencoded&quot; }, method = RequestMethod.POST)
  public ResponseEntity&lt;Void&gt; createOrderForm(@Valid @ModelAttribute OrderCreateDTO orderCreateDTO) {
      return doCreateOrder(orderCreateDTO);
  }
  </code></pre>
  <p>The second method is fine, but there is an issue with the first.
  In the method, when I sending an enum field, I got the following errors:</p>
  <pre><code>JSON parse error: Cannot construct instance of `......service.dto.EuropeanLanguageEnumTypeDTO`, problem: Unexpected value 'EN'; nested exception is com.fasterxml.jackson.databind.exc.ValueInstantiationException: Cannot construct instance of `......service.dto.EuropeanLanguageEnumTypeDTO`, problem: Unexpected value 'EN'\n at [Source: (PushbackInputStream); line: 6, column: 17] (through reference chain: ......service.dto.OrderCreateDTO[\&quot;language\&quot;])
  
  Resolved [org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Cannot construct instance of `.......service.dto.EuropeanLanguageEnumTypeDTO`, problem: Unexpected value 'EN'; nested exception is com.fasterxml.jackson.databind.exc.ValueInstantiationException: Cannot construct instance of `......service.dto.EuropeanLanguageEnumTypeDTO`, problem: Unexpected value 'EN'
   at [Source: (PushbackInputStream); line: 6, column: 17] (through reference chain: ......service.dto.OrderCreateDTO[&quot;language&quot;])]
  </code></pre>
  <p><strong>EuropeanLanguageEnumTypeDTO.java</strong>:</p>
  <pre class="lang-java prettyprint-override"><code>public enum EuropeanLanguageEnumTypeDTO {
    
    BG(&quot;bg&quot;),
    
    HR(&quot;hr&quot;),
    
    CS(&quot;cs&quot;),
    
    EN(&quot;en&quot;);
  
    private String value;
  
    EuropeanLanguageEnumTypeDTO(String value) {
      this.value = value;
    }
  
    @JsonValue
    public String getValue() {
      return value;
    }
  
    @Override
    public String toString() {
      return String.valueOf(value);
    }
  
    @JsonCreator
    public static EuropeanLanguageEnumTypeDTO fromValue(String value) {
      for (EuropeanLanguageEnumTypeDTO b : EuropeanLanguageEnumTypeDTO.values()) {
        if (b.value.equals(value)) {
          return b;
        }
      }
      throw new IllegalArgumentException(&quot;Unexpected value '&quot; + value + &quot;'&quot;);
    }
  }
  </code></pre>
  <p>Also, I've another component, to convert enum, but it just works only with 'form' request:</p>
  <pre class="lang-java prettyprint-override"><code>@Component
  public class EuropeanLanguageEnumConverter implements Converter&lt;String, EuropeanLanguageEnumTypeDTO&gt; {
  
      @Override
      public EuropeanLanguageEnumTypeDTO convert(String value) {
          return EuropeanLanguageEnumTypeDTO.fromValue(value);
      }
  
  }
  </code></pre>
  <p>Example of working JSON and not working:</p>
  <p><strong>success</strong>:</p>
  <pre><code>{
      &quot;language&quot;: &quot;en&quot;
  }
  </code></pre>
  <p><strong>fail</strong>:</p>
  <pre class="lang-json prettyprint-override"><code>{
      &quot;language&quot;: &quot;EN&quot;
  }
  </code></pre>
  <p>I need to work with upper and lower case.<br />
  I search a lot and tried some different ways, such as <code>jackson.mapper.ACCEPT_CASE_INSENSITIVE_ENUMS: true</code>, but didn't work, please help me with this issue.</p>
  <p>P.s. for some reason I can't edit inside ENUM class, because it will generate with openAPI.</p>