I want to send my data to server in the form of Json, I have written coding part which will send my data in the form of Json now I want to test this code. Now the problem is at present my server side code is not complete so how do I so it. I want to send three strings to the server side and I have used this link to convert the output in form of Json. Android JSON HttpClient to send data to PHP server with HttpResponse Thanks in advance
Asked
Active
Viewed 243 times
0
-
I have written in this form StringEntity s = new StringEntity(c.toString()); s.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); where c is JSONObject – prateek Jan 17 '12 at 12:39
-
I don't get it, JSONObject class is supposed to generate the JSON output correctly everytime you call toString(). Thats if you added the values. Like: **JSONObject c = new JSONObject(); c.put("string1", "prateek"); c.put("string2", "me"); c.put("string3", "you"); string finalJson = c.toString();** – WoLfulus Jan 17 '12 at 12:44
-
when you print "j.toString()" ? – WoLfulus Jan 17 '12 at 12:49
-
@WoLfulus JSONObject class is generating the JSON output correctly what i want is to check weather my rest of the code which I have taken from this link
is working or not so how to do it. and sorry for above comment it was my mistake, i have not putted any data in strings tht why it was showing only curl braces – prateek Jan 17 '12 at 12:57
1 Answers
0
you can simply put Toast or System.out.println to check your output Json Format.

Lucifer
- 29,392
- 25
- 90
- 143
-
-
I want to write my code in such a way that when my server side code is ready then I just have to replace the Url to my server Url. I have used link mentioned in the question for the reference – prateek Jan 17 '12 at 12:42