Reputation: 51
This is my JSON Array, I am unable to parse ItemImage1
and Bytes
from this JSON array.
Can any one help me.
{"FetchAllItemsResult":[{"ItemID":5,
"ItemCategoryID":225,
"ItemCode":"1263",
"barcode":"0010000005",
"ItemDescription":"CAKE TRAY ROUND TEFAL 1 PCS (L) [RETAIL]",
"packingtypeid":1,
"ItemImage1":{"Bytes":[137,80,78,71,13,10,26,....]},
"sellingPrice":350.00,
"TaxPercentage":6.00},..]}
This is my Product Class.
public class Product{
@SerializedName("ItemID")
int itemID;
@SerializedName("ItemCategoryID")
int itemCategoryID;
@SerializedName("ItemCode")
String itemCode;
@SerializedName("barcode")
String barCode;
@SerializedName("ItemDescription")
String itemDescription;
@SerializedName("packingtypeid")
int packingTypeID;
@SerializedName("sellingPrice")
double sellingPrice;
@SerializedName("TaxPercentage")
double taxPercentage;
@SerializedName("ItemImage1")
ProductImage itemImage;
}
This is ProductImage Class.
public class ProductImage {
@SerializedName("Bytes")
byte[] itemImage;
}
This is ProductList class to hold the entire JSON Array.
public class ProductList {
@SerializedName("FetchAllItemsResult")
List<Product> Products;
}
I'm using Volley
GsonRequest<ProductList>
There are no errors but I cannot get Image Bytes(ItemImage1
and Bytes
) from JSON array, please help me.
This is the output I'm getting for Bytes array.
[B@b2e761c8
Upvotes: 0
Views: 527
Reputation: 44844
try printing the output using
http://docs.oracle.com/javase/7/docs/api/java/util/Arrays.html#toString(byte[])
Upvotes: 1