title: JSON parse error: Can not construct instance of class
body: <p>Unable to map json string with java object, getting error JSON parse error: Can not construct instance of com.test.CPInput$Evc$Uni</p>
  
  <p>error:</p>
  
  <pre><code>{
  "timestamp": 1502270576300,
  "status": 400,
  "error": "Bad Request",
  "exception": "org.springframework.http.converter.HttpMessageNotReadableException",
  "message": "**JSON parse error: Can not construct instance of com.test.CPInput$Evc$Uni: can only instantiate non-static inner class by using default, no-argument constructor; nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not construct instance of com.test.CPInput$Evc$Uni: can only instantiate non-static inner class by using default, no-argument constructor at [Source: java.io.PushbackInputStream@edc246; line: 20, column: 9] (through reference chain: com.test.CPInput["evc"]-&gt;com.test.CPInput$Evc["uni"]-&gt;java.util.ArrayList[0]**)",
  "path": "/demo/addCustomer"
  }
  </code></pre>
  
  <p>json</p>
  
  <pre><code>{
    "customerId": "abcdef",
    "customerSegment": {
      "customerType": "customer type",
      "customerSubtype": "subtype",
      "industry": "industry",
      "subIndustry": "subindustry",
      "specialPopulation": " spl population"
    },
    "evc": {
      "evcId": "evcid",
      "action": "PR",
      "serviceId": "assigned prod id",
      "previousValues": {
          "previousName":"evcId",
          "previousValue":"EVC id - OLD"
      },
      "uni": [
        {
          "type": "uniA",
          "uniId": "uni id",
          "siteId": "sidt id",
          "tspCode": "tsp code",
          "elocId": "e loc id",
          "siteClli": "site clli",
          "uniAction": "PR",
          "previousValues": {
              "previousName":"evcId",
              "previousValue":"EVC id - OLD"
          }
        },
        {
          "type": "uniZ",
          "siteId": "sidt id",
          "tspCode": "tsp code",
          "elocId": "e loc id",
          "siteClli": "site clli",
          "uniAction": "PR",
          "previousValues": {
              "previousName":"evcId",
              "previousValue":"EVC id - OLD"
          }
        }
      ]
    },
    "solutionType": "EPL",
    "source": "Orion"
  }
  </code></pre>
  
  <p>CPInput.java</p>
  
  <pre><code>public class CPInput {
  
  
      private String customerId;
      private CustomerSegment customerSegment;
      private Evc evc;
      private String solutionType;
      private String source;
  
      public CPInput() {
          super();
      }
  
      public class CustomerSegment{
          private String customerType;
          private String customerSubtype;
          private String industry;
          private String subIndustry;
          private String specialPopulation;
          //getter setter
  
      }
  
      public class Evc{
          private String evcId;
          private String action;
          private String serviceId;
          private PreviousValues previousValues;
          private List&lt;CPInput.Evc.Uni&gt; uni=new ArrayList&lt;CPInput.Evc.Uni&gt;();
          //getter setter
  
          public class PreviousValues{
              private String previousName;
              private String previousValue;
              //getter setter
  
          }
  
  
          public class Uni{
              private String type;
              private String uniId;
              private String siteId;
              private String tspCode;
              private String elocId;
              private String siteClli;
              private String uniAction;
              private PreviousValues previousValues;
              //getter setter
  
              public class PreviousValues{
                  private String previousName;
                  private String previousValue;
                  //getter setter
  
      }
  
  //getter setter
  
  }
  </code></pre>
  
  <p>DemoController.java</p>
  
  <pre><code>@RestController
  @SpringBootApplication(scanBasePackages = {"com.test"})
  @RequestMapping(value = "/demo")
  public class DemoController {
  
      @RequestMapping(method = RequestMethod.POST, value = "/addCustomer")
      public CPOutput addCustomer(@RequestBody CPInput input) {
          System.out.println(input);      
          return null;
      }
  
  }
  </code></pre>