Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JSON Deserializing with Json Parsing in Android Application

What does "deserializing Json" mean, I have seen this term on the Web. I don't know the meaning of this particular term. It would be great if anybody could explain to me what it means.

like image 570
David Brown Avatar asked Dec 30 '25 09:12

David Brown


1 Answers

JSON is a method for representing data in a light-weight text-based form. For instance, an array of contacts in a phone book might be stored as follows;

{"contacts": [
  {"name": John, "phoneNumber":"+44000000000"},
  {"name": Jack, "phoneNumber":"+44000000001"}
]}

It's primary purpose is for use when transporting data to web-services. It seems to be especially popular with REST.

Serializing your data to JSON is the process of turning what might be an 'Array()' in your Java code into a text based representation of that data as shown above. De-Serializing JSON is that process in reverse. In the above example, Deserializing the JSON is the process of translating the text for the contactcs shown above into a data array in your Java application.

Fortunately, the Android SDK makes it easy to access a JSON library that will handle this process for you. http://developer.android.com/reference/org/json/JSONObject.html

And the following GSON library makes life even easier. http://sites.google.com/site/gson/gson-user-guide

There are a bunch of REST with Android examples on the web, they will almost definitely be able to help you out.

http://senior.ceng.metu.edu.tr/2009/praeda/2009/01/11/a-simple-restful-client-at-android/

http://www.josecgomez.com/2010/04/30/android-accessing-restfull-web-services-using-json/

like image 90
John Wordsworth Avatar answered Jan 01 '26 23:01

John Wordsworth