0
我遇到問題。我的應用程序不會從我的Web服務加載資源,因爲它的格式已更改。將JSON對象轉換爲JSON數組
我的web服務之前返回一個JSON數組是這樣的:
[{"productid":2,"sku":"SKU-2","productname":"SMART NEW","productdesc":"description","category":"default category","price":2000.1,"picture":"http://10.23.20.50:8080/msos-ws/images/products/smart.gif","remarks":"remarks"}]
現在,它返回一個JSON對象我想:
{"product":[{"category":"default category","picture":"http://localhost:8080/msos-ws/images/products/smart.gif","price":"480.0","productdesc":"Dragon Flash Disk (Special)","productid":"7","productname":"Kingston 8GB","remarks":"remarks","sku":"SKU-7"}]}
這裏是我的代碼在後端:
@GET
@Override
@Produces("application/json")
public List<Product> findAll() {
return prodManager.getProducts();
}
我返回一個列表,所以它應該在數組中,對嗎?