Jackson with JSON : receiving "null" object
<p>I need to convert a Uber Products JSON response from <a href="https://developer.uber.com/docs/rides/api/v1-products" rel="nofollow">here</a> to a Java object. I am using Jackson for JSON handling. My input JSON looks like:</p>

<pre><code>    {
      "products": [
        {
           "capacity": 2,
           "description": "Ride for less with uberPOOL",
           "price_details": {},
           "image": "http://d1a3f4spazzrp4.cloudfront.net/car.jpg",
           "display_name": "POOL",
           "product_id": "26546650-e557-4a7b-86e7-6a3942445247",
           "shared": true,
        },
        {
           "capacity": 4,
           "description": "The low-cost Uber",
           "price_details": {
              "distance_unit": "mile",
              "cost_per_minute": 0.26,
              "service_fees": [
                 {
                    "fee": 1.0,
                    "name": "Safe Rides Fee"
                 }
              ],
              "minimum": 5.0,
              "cost_per_distance": 1.3,
              "base": 2.2,
              "cancellation_fee": 5.0,
              "currency_code": "USD"
           },
           "cash_enabled": false,
           "image": "http://d1a3f4spazzrp4.cloudfront.net/car.jpg",
           "display_name": "uberX",
           "product_id": "a1111c8c-c720-46c3-8534-2fcdd730040d",
           "shared": false
        }
      ]
    }
</code></pre>

<p>My entity class looks like:</p>

<pre><code>    public class Products {

        @JsonProperty
        private int capacity;
        @JsonProperty
        private String description;
        @JsonProperty
        private String price_details;
        @JsonProperty
        private String image; 
        @JsonProperty
        private Boolean cash_enabled; 
        @JsonProperty
        private Boolean shared; 
        @JsonProperty
        private String short_description; 
        @JsonProperty
        private String display_name;

            //getter, setter methods
    } 
</code></pre>

<p>and wrapper class looks like:</p>

<pre><code>    public class ProductsModel{
        private List &lt;Products&gt; product;

        public List&lt;Products&gt; getProduct() {
            return product;
        }
        public void setProduct(List&lt;Products&gt; product) {
            this.product = product;
        }
    }
</code></pre>

<p>now when i try map the JSON to my wapper class and try to print the products .. it is giving "null" not sure why .. please help to point out why.</p>

<pre><code>    private ObjectMapper mapper = new ObjectMapper();
    mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
    productsModel = mapper.readValue(line1, ProductsModel.class);   
    response.getWriter().println("get products:" + productsModel.getProduct()); //&lt;-- returns null - not sure why
</code></pre>