-5

Possible Duplicate:
JSON Parsing in Android

I am working on app in which i want to parse request from server side. Can anyone help me in this , i mean to say i simply want to know that how to parse json....

Community
  • 1
  • 1
Aditya1510
  • 874
  • 1
  • 14
  • 31
  • Similar http://stackoverflow.com/questions/3706515/json-parsing-in-android http://stackoverflow.com/questions/2818697/sending-and-parsing-json-in-android http://stackoverflow.com/questions/3581816/i-need-a-simple-java-example-of-processing-a-json-response-via-http-for-android – Phani Kumar Bhamidipati Oct 20 '11 at 09:11

4 Answers4

4

To parse JSON you can use the JSON library included in Android.

String json = "{\"type\":\"resource_updates\" }"

JSONObject object = new JSONObject(json);
String type = object.getString("type"));

Also see http://developer.android.com/reference/org/json/JSONObject.html for all available get methods

Mats Hofman
  • 6,810
  • 6
  • 32
  • 48
0

Android has build in support for json library you can check this api org.json

you can use other libraries as well like Gson or jackson you need to add them to your build path first to use them

Check out these two questions on SO as well

Sending and Parsing JSON Objects

I need a simple java example of processing a JSON response via HTTP for Android App?

Community
  • 1
  • 1
Phani Kumar Bhamidipati
  • 13,108
  • 6
  • 22
  • 26
0

The data you are sending is not valid base 64 data since, among other things, you have newline characters in the base 64-string. Also, the string is too long so it doesn't even show your whole question.

Pocket Universe
  • 1,370
  • 1
  • 8
  • 9
-2

You can add a JSON library for Java.

Here's how to do it: http://www.vogella.de/blog/2010/02/11/java-library-jar-android/

Sathyajith Bhat
  • 20,587
  • 21
  • 94
  • 129
Karudosu
  • 85
  • 2
  • 11