-2

I creats one apps in android.I have fetch data from server side useing json but i have proble how to send json string or jso to server

KeTaN
  • 724
  • 8
  • 22
  • i have answered a similar question with some code example. please check [`this answer`](http://stackoverflow.com/questions/8950279/save-posts-to-rails-server-from-java-android-application-with-devise-authentica/8950868#8950868). – AD14 Jan 24 '12 at 07:14

2 Answers2

0

You can create JsonObject, put data in it and then convert it toString() for sending. How to do sending itself depends on your server. Also, refer this question.

Community
  • 1
  • 1
sandrstar
  • 12,503
  • 8
  • 58
  • 65
0

I will advice you to use a fast parser if your data is large. I use Jackson. And you can find related code. With Jackson you can use Object Mapper for default map conversion

ObjectMapper objectMapper = new ObjectMapper();
httppost.addData("points", getMapper().writeValueAsString(points));
InputStream instream = httpclient.execute(httppost).getEntity().getContent();
return getMapper().readValue(instream, HashMap.class);
Seray Uzgur
  • 113
  • 7