title: Post API using Spring Boot returns null values for nested json
body: <p>I am new to Spring boot, and was trying to create a post api to post the following json to.
  However, when I do a get on the api, for  the nested elements, null values are displayed.</p>
  <p>Json Request:</p>
  <pre><code>{
    &quot;messageType&quot;: &quot;abcd&quot;,
    &quot;messageVersion&quot;: &quot;1.1.0&quot;,
    &quot;p_messageVersion&quot;: &quot;1.095&quot;,
    &quot;acsTransID&quot;: &quot;6834628&quot;,
    &quot;p_formValues_BRW&quot;: {
      &quot;action&quot;: &quot;http://10.10.65.96:8080/CORE/Test.htm&quot;,
      &quot;correctFormData&quot;: &quot;1234&quot;,
      &quot;incorrectFormData&quot;: &quot;0000&quot;,
      &quot;cancelFormData&quot;: &quot;true&quot;
    }
  }
  </code></pre>
  <p>Response on Doing a Get:</p>
  <pre><code>[{&quot;acsTransID&quot;:&quot;6834628&quot;,&quot;p_messageVersion&quot;:&quot;1.095&quot;,&quot;messageVersion&quot;:&quot;1.1.0&quot;,&quot;messageType&quot;:&quot;abcd&quot;,&quot;p_formValues_BRW&quot;:{&quot;action&quot;:null,&quot;correctFormData&quot;:null,&quot;incorrectFormData&quot;:null,&quot;cancelFormData&quot;:null}}]
  </code></pre>
  <p>My Model Object</p>
  <pre><code>public class Product {
         @JsonProperty(&quot;acsTransID&quot;)
         private String acsTransID;
         
         @JsonProperty(&quot;p_messageVersion&quot;)
         private String p_messageVersion;
         
         @JsonProperty(&quot;messageVersion&quot;)
         private String messageVersion;
         
         @JsonProperty(&quot;messageType&quot;)
         private String messageType;
         
         @JsonProperty(&quot;p_formValues_BRW&quot;)
         private p_formValues_BRW p_formValues_BRW;
         
         public Product(p_formValues_BRW p_formValues_BRW) {
             this.p_formValues_BRW=p_formValues_BRW;
         }
         
         public Product() {
             
         }
         
  
         public String getacsTransID() {
            return acsTransID;
         }
         public void setacsTransID(String acsTransID) {
            this.acsTransID = acsTransID;
         }
         public String getp_messageVersion() {
            return p_messageVersion;
         }
         public void setp_messageVersion(String p_messageVersion) {
            this.p_messageVersion = p_messageVersion;
         }
         
         public String getmessageVersion() {
                return messageVersion;
             }
         
         public void setmessageVersion(String messageVersion) {
                this.messageVersion = messageVersion;
             }
         
         public String getmessageType() {
                return messageType;
             }
         
         public void setmessageType(String messageType) {
                this.messageType = messageType;
             }
         
  
         public p_formValues_BRW getp_formValues_BRW() {
         return p_formValues_BRW;
         }
  
         
         public void setp_formValues_BRW(p_formValues_BRW p_formValues_BRW) {
         this.p_formValues_BRW = p_formValues_BRW;
         }
         
  /*     
         public Product withPFormValuesBRW(PFormValuesBRW pFormValuesBRW) {
             this.pFormValuesBRW = pFormValuesBRW;
             return this;
             }*/
             
  }
  
  class p_formValues_BRW {
      
      @JsonProperty(&quot;action&quot;)
      private String action;
      
      @JsonProperty(&quot;correctFormData&quot;)
      private String correctFormData;
      
      @JsonProperty(&quot;incorrectFormData&quot;)
      private String incorrectFormData;
      
      @JsonProperty(&quot;cancelFormData&quot;)
      private String cancelFormData;
  
      
      public String getaction() {
      return action;
      }
  
      public void setaction(String action) {
      this.action = action;
      }
  
  
      public String getcorrectFormData() {
      return correctFormData;
      }
  
  
      public void setcorrectFormData(String correctFormData) {
      this.correctFormData = correctFormData;
      }
  
  
      public String getincorrectFormData() {
      return incorrectFormData;
      }
  
  
      public void setincorrectFormData(String incorrectFormData) {
      this.incorrectFormData = incorrectFormData;
      }
  
  
      public String getcancelFormData() {
      return cancelFormData;
      }
  
  
      public void setcancelFormData(String cancelFormData) {
      this.cancelFormData = cancelFormData;
      }
  
  
  }
  </code></pre>
  <p>My Controller</p>
  <pre><code>@RestController
  public class ProductServiceController {
      
  
     private static Map&lt;String, Product&gt; productRepo = new HashMap&lt;&gt;();
  
     @RequestMapping(value = &quot;/products&quot;, method = RequestMethod.POST)
     public ResponseEntity&lt;Object&gt; createProduct(@RequestBody Product product, p_formValues_BRW p_formValues_BRW) {
         product.setp_formValues_BRW(p_formValues_BRW);
        productRepo.put(product.getacsTransID(), product);
  //      productRepo.put(product., PFormValuesBRWRepo);
        return new ResponseEntity&lt;&gt;(&quot;Product is created successfully&quot;, HttpStatus.CREATED);
     }
     
     @RequestMapping(value = &quot;/products&quot;)
     public ResponseEntity&lt;Object&gt; getProduct() {    
        return new ResponseEntity&lt;&gt;(productRepo.values(), HttpStatus.OK);
     }
  }
  </code></pre>
  <p>What I am doing wrong. Also, would it be better to use JPARepositories and @autowired.</p>