Question

I'm trying to pass byte array in json via web service. When i try to Deserialize the JSON the byte array value changed to unknow value.

For an example. My byte value when i try to pass to webservice using android.
Code

JSONObject object = new JSONObject();
try {
object.put("WayBillNo", bill);
object.put("ReceiverSignature", image);
} catch (JSONException e) {
e.printStackTrace();
}

Image image

WebService when trying to serialize the JSON. (C#)

Code

payloadObj = JsonConvert.DeserializeObject<T>( encryptedJson );

Image image2

Receiversingnature value change in web service.Any advice/help is appreciated.

Was it helpful?

Solution

I use Base64 which converts binary data to a string.

byte [] image = array;
String stringToStore = new String(Base64.encode(image));
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top