0

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

4
  • 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 Commented Jan 17, 2012 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(); Commented Jan 17, 2012 at 12:44
  • when you print "j.toString()" ? Commented Jan 17, 2012 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 <Android JSON HttpClient to send data to PHP server with HttpResponse> 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 Commented Jan 17, 2012 at 12:57

1 Answer 1

0

you can simply put Toast or System.out.println to check your output Json Format.

Sign up to request clarification or add additional context in comments.

2 Comments

WOP programming on its purest form :)
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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.