tags:

views:

1268

answers:

2

Hello all,

I am using json to communicate with the server.

I want to post and grab an image from the server.

How to convert the image in json format to send it, also when we get an image in json format and convert it back to image.

A: 

Image is binary - you would be probably better send link to the image in your JSON otherwise you need to deal with base64

DroidIn.net
But what while sending the image.
rkb
What do you mean by "while sending the image"? What are you trying to do with that image? Display it dynamically? You still far better off just updating location in your JS then trying to render that image from binary stream
DroidIn.net
+3  A: 

Please refer to the relevant section of the HTML spec for how to properly upload binary data.

JSON objects are posted using a very inefficient encoding for binary data. Utilizing the existing frameworks and standards for uploading binary data will save you a tremendous amount of time.

CptSkippy
Ditto -- just POST it, skip the JSON.
Will Hartung