title: Enums as Request Parameters in Spring Boot Rest
body: <p>I am new to spring boot and trying to use Enum as a parameter of a rest request.</p>
  
  <p>This is my Enum class:</p>
  
  <pre class="lang-java prettyprint-override"><code>public enum Month {
  
      JANUARY (1, "january"), FEBRUARY(2,"february"), MARCH(3,"march"),
      APRIL(4,"april"), MAY(5,"may"), JUNE(6,"june"), JULY(7,"july"),
      AUGUST(8, "august"), SEPTEMBER(9,"september"), OCTOBER(10,"october"),
      NOVEMBER(11,"november"), DECEMBER(12,"december");
  
      private String desc;
      private int id;
  
      //Constructure
  
      //Getters and Setters
  }
  </code></pre>
  
  <p>In my controller class I am using this method:</p>
  
  <pre class="lang-java prettyprint-override"><code>    @RequestMapping(value = "/testmonth", method = RequestMethod.POST)
          public Month TestForMonth(@RequestBody Month inputPayload) {
              Month response = inputPayload;
              response.setId(inputPayload.getId());
              response.setDesc(inputPayload.getDesc());
              System.out.println("As String: " + inputPayload.getDesc() + ". As int " + inputPayload.getId() + ".");
              return response;
          }
  </code></pre>
  
  <p>This is my JSON:</p>
  
  <pre><code>{
      Month: "JANUARY"
  }
  </code></pre>
  
  <p>But it is not working.. I am getting this error:</p>
  
  <pre><code>.w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Cannot deserialize instance of `com.example.simplerestapis.models.Month` out of START_OBJECT token; nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `com.example.simplerestapis.models.Month` out of START_OBJECT token
   at [Source: (PushbackInputStream); line: 1, column: 1]]
  </code></pre>