简体   繁体   中英

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.

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/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM