title: JSON.decodeValue Decode Exception
body: <p>I want to make this java code works:</p>
  
  <pre><code>RequestManager rm = Json.decodeValue(request.getBodyAsString(), RequestManager.class);
  </code></pre>
  
  <p>But i have this error:</p>
  
  <p><code>io.vertx.core.json.DecodeException: Failed to decode:No suitable constructor found for type [simple type, class RequestManager]: can not instantiate from JSON object (missing default constructor or creator, or perhaps need to add/enable type information?)
   at [Source: {"messageId":"fsdfsdf"}; line: 1, column: 2]</code></p>
  
  <p>And here the code of my class :</p>
  
  <pre><code>public class RequestManager {
      private String messageId;
      private String messageContent;
  
      public RequestManager(String messageId, String messageContent) {
          this.messageId = messageId;
          this.messageContent = messageContent;
      }
  
      public String getMessageId() {
          return messageId;
      }
  
      public String getMessageContent() {
          return messageContent;
      }
  }
  </code></pre>
  
  <p>I really don't know why it's not working and there is only few topics about it, but they were irrelevant.</p>
  
  <p>Someone can help ?</p>
  
  <p>EDIT--</p>
  
  <p>I know  have the RequestManager class like this:</p>
  
  <pre><code>public class RequestManager {
      private String messageId;
      private String messageContent;
  
      public RequestManager(String messageId, String messageContent) {
          this.messageId = messageId;
          this.messageContent = messageContent + "check";
      }
  
      public RequestManager() {
  
      }
  
      public String getMessageId() {
          return messageId;
      }
  
      public String getMessageContent() {
          return messageContent;
      }
  
      public void setMessageId(String messageId) {
          this.messageId = messageId;
      }
  
      public void setMessageContent(String messageContent) {
          this.messageContent = messageContent;
      }
  }
  </code></pre>
  
  <p>But know when i try to print the fields of my <code>RequestManager</code> object created with the <code>JSON.decodeValue</code> it's return me null. I've already done that in the past and had the same error. I think it's because the empty constructor is used instead.
  I still don't really understand....</p>
  
  <p>EDIT--2</p>
  
  <p>I have tried to change my class again, here it is:</p>
  
  <pre><code>@JsonIgnoreProperties(ignoreUnknown=true)
  public class RequestManager {
      @JsonProperty("messageId") private String messageId;
      @JsonProperty("messageContent") private String messageContent;
  
      @JsonCreator
      public RequestManager(@JsonProperty("messageId") String messageId, @JsonProperty("messageContent") String messageContent) {
          this.messageId = messageId;
          this.messageContent = messageContent;
          System.out.println("This constructor is used.");
      }
  
      public RequestManager() {
  
      }
  
      public String getMessageId() {
          return messageId;
      }
  
      public String getMessageContent() {
          return messageContent;
      }
  
      public void setMessageId(String messageId) {
          this.messageId = messageId;
      }
  
      public void setMessageContent(String messageContent) {
          this.messageContent = messageContent;
      }
  }
  </code></pre>
  
  <p>And this is in my main :
     <code>final RequestManager rm = Json.decodeValue("{\"messageId\":\"themessage\"}", RequestManager.class);
              System.out.println(rm.getMessageContent());</code></p>
  
  <p><code>"{\"messageId\":\"themessage\"}"</code> = the JSON format, i'm sure of it because decodeValue would return a Decode Exception if it wasn't.</p>
  
  <p>Now the field is "nullcheck" when i print it. So it means that the constructor is well used but the fields are nulls. Where am i doint it wrong ?</p>