user1002448
user1002448

Reputation: 415

Convert JsonArray to byte[] array in android

I have the following jsonarray:

{
"_id" :"value", "data": "value", "array" : [{ "x" : "value", "y" : "value" }, { "x" : "value", "y" : "value" }] }

How to convert this to byte[] array ?

Upvotes: 2

Views: 7539

Answers (1)

user1048839
user1048839

Reputation: 958

public byte[] objectToBytArray( Object ob ){
 return ((ob.toString()).getBytes());
}

Pass your JSONArray as the object here.

Upvotes: 4

Related Questions