Today we are going to see How to parse JSON Rest Web Service in Android Application. JSON is Java Script Object Notation location. You can get more information about JSON here. Here I am considering that you have basic idea about Android.So Let's start....
Create New Android Project in Eclipse.
1. Name Of Project :- TestJSONWebService
2. Build Target :- Android(2.2)
3. Application Name :- TestWebService
4. Package Name :- parallelminds.webservice.com
5. Create Activity :- TestWebServiceActivity
Here in this class I am making a call to JSON webservice/URL which is hosted on the server using a method ParseJSON().Here in this method I am calling one method of CallWebService class.That method is used to create connection and get the content in the webservice.After getting all the response that response is stored in one response object.Contents in the response object are read using InputStreamReader and stored in one object.The whole content in the object is converted into string.And that string is assign to the JSONArray.That means CallWebService class will return JSONArray object.
By using this JSONArray object I had shone all the contents in ListView.The most important point here we need to mention is that while taking ListView the id of ListView in the main.xml should be "@id/android:list".That is what we need to do for calling JSON's restful web service.
Jason parsing
Create New Android Project in Eclipse.
1. Name Of Project :- TestJSONWebService
2. Build Target :- Android(2.2)
3. Application Name :- TestWebService
4. Package Name :- parallelminds.webservice.com
5. Create Activity :- TestWebServiceActivity
Here in this class I am making a call to JSON webservice/URL which is hosted on the server using a method ParseJSON().Here in this method I am calling one method of CallWebService class.That method is used to create connection and get the content in the webservice.After getting all the response that response is stored in one response object.Contents in the response object are read using InputStreamReader and stored in one object.The whole content in the object is converted into string.And that string is assign to the JSONArray.That means CallWebService class will return JSONArray object.
By using this JSONArray object I had shone all the contents in ListView.The most important point here we need to mention is that while taking ListView the id of ListView in the main.xml should be "@id/android:list".That is what we need to do for calling JSON's restful web service.
Jason parsing















