Skip to content

derAndroidPro/JsonReaderExample_Android

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Android: JsonReader Example

This is an example of how to use Android's JsonReader class to read data from a JSON array and convert the JSON array of JSON objects to an ArrayList of Java objects.

The app downloads a JSON script from a server. The JSON-Script contains an array of persons with their name, profession and age. The app decodes this information and saves it as an ArrayList of Java objects of the class "Person". At the end the app displays all the data to the user using a textview (as you can see in the screenshot).

I wrote lots of comments in the code, so it should be easy to understand.

Important Files:

The JSON-Script:

{
  "user":[
    {
      "name":"John Doe",
      "profession":"Doctor",
      "age":27
    },
    {
      "name":"Mike Miller",
      "profession":"Musician",
      "age":40
    },
    {
      "name":"Bob Graham",
      "profession":"Programmer",
      "age":32
    }
  ]
}

The Result:

About

An example of how to use Android's JsonReader to decode a JSON array

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages