Trouble converting Json Array into Pojo with array of pojos
<p>JSON String </p>

<pre><code>{
"order":{
  "address":{
     "city":"seattle"
  },
  "orderItem":[
     {
        "itemId":"lkasj",
        "count":2
     },
     {
        "itemId":"ldka",
        "count":3
     }
  ]
   }
}
</code></pre>

<p>Order Class</p>

<pre><code>public class Order {
private OrderItem[] orderItems;
private CustomerAddress address;

Order(OrderItem[] orderItems, CustomerAddress address ) {
    this.orderItems = orderItems;
    this.address = address;

}

public OrderItem[] getOrderItems() {
    return orderItems;
}

public void setOrderItems(OrderItem[] orderItems) {
    this.orderItems = orderItems;
}

public CustomerAddress getAddress() {
    return address;
}

public void setAddress(CustomerAddress address) {
    this.address = address;
}
}
</code></pre>

<p>My OrderItem class
    package com.cbd.backend.model;</p>

<pre><code>import org.springframework.data.annotation.Id;

public class OrderItem {
    @Id
    private String id;
    private String itemId;
    private String count;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

unit Test that blows up

    public String getItemId() {
        return itemId;
    }

    public void setItemId(String itemId) {
        this.itemId = itemId;
    }

    public String getCount() {
        return count;
    }

    public void setCount(String count) {
        this.count = count;
    }
}
</code></pre>

<p>Unit test to demonstrate issue
    package com.cbd.backend.model;</p>

<pre><code>import com.google.gson.Gson;
import org.junit.Test;
import static org.junit.Assert.*;
public class OrderTest {

  Gson gson = new Gson();
  @Test
    public void gsonToOrder() {
        Order order = gson.fromJson( a, Order.class );
        assertNotNull(order);
        assertNotNull(order.getOrderItems()[0]);
    }
    private final String a = "{ \"order\": { \"address\": { \"city\": \"seattle\" },\"orderItem\":[{ \"itemId\":\"lkasj\", \"count\":2 }, { \"itemId\":\"ldka\", \"count\":3 } ] } }";
}
</code></pre>

<p>Should I be using something other than gson or am i constructing this incorrectly</p>