Removing special characters in Json while sending to server - android

hi after computing im getting json as below
{"xxxx":"{\"value\":\"http:\\\/\\\/blaze.mobiclay.net\\\/action\\\/qzproject\\\/feed\\\/20111015\\\/getfeedurl?feedID=702\",\"type\":\"RSS\"}","yyyy":"{\"value\":\"chg\",\"type\":\"String\"}","zzzz (mins)":"{\"value\":\"3\",\"type\":\"String\"}",
but i need it as below when i need to send it to server
{"xxxx":{"type":"RSS","value":""},"zzzz (mins)":{"type":"String","value":""},"yyyy":{"type":"String","value":""}}

I think this is you are looking for:-)
encode
and decode

Related

Is it possible to send array of image through volley

Is is possible to send array of images using volley library in android.
e.g
param.put("images", arrayOfImages);
Please response as soon as possible.
Yes you can convert the images in base64 strings and send that array of strings using
param.put("images", arrayOfImages);

Send image via json in android

Hi I am working with android.I want to send an image from server to android and I had done it with sending url from server.How can I send an image from server to android app via json?? is it possible??
It is possible if you can convert your image at your server to a Base64 encoding string. Then you can send the string to your app via JSON.
You can use Apache Common IOUtils:
Base64.encode(FileUtils.readFileToByteArray(imageFile));
On your app you can convert the string to image, example in this link
How to convert a Base64 string into a BitMap image to show it in a ImageView?
Hope that helps
It is possible to send binary data within Json but you have to escape the binary data (UTF-8 encoding and use Base64.) This will increase the data size. Why not just include the path in JSON and fetch/load it?

wanted to post image from android to WCF rest service

I want to upload or post a image file on server using REST WCF. For this I am using JSON as input format.
But when I am checking this post call with debugger due to Base64 image data input is not accepted by the debugger .
I was giving me the 400-Bad Request response for this call.
Thanks.
First understand the concept of JSON/REST.
Then Make your WCF method to input the Byte[] i.e. Byte Array.
Convert your Image in Base64 and Pass it to the REST.
In order to send Image to JSON Web Service, you need to convert that to Byte Array or Base 64 String Representation.
Hope this helps.

Android: incomplete soap response?

I make a soap request in my Android app using HttpURLConnection the response is a base64 encoded string holding the data of an image.
the problem is that the response always received in complete. so the image can not be constructed correctly.
what can be the reason for this ?
thanks
A friend of mine blogged about this a year or so ago. Base64 is supposed to be built in, but isn't/wasn't? He has details here.
Possibly server is sending the incorrect Content-Length header.
Did you write the server code?
Happened to me once when I was reporting the content length based on the size of buffer not the actual size of data inside buffer.

Android: How to send a picture through a service

I wonder how is it possible to send a picture.
I am using json to send data and store to database.
But how do I handle a picture?
How do I send it using json?
Look at this:
How to send an image using json to server in iPhone?
Have a look here, shows how to use HTTP with Java:
http://www.java-samples.com/java/POST-toHTTPS-url-free-java-sample-program.htm
Never send bytes, encode it with base64 and compressing does not really help.

Categories

Resources