JSon Example In Android

JSon Example in Android

This example explains how to handle JSon parser. It shows how to read and write data to and from a JSon file.

Algorithm:

1.) Create a new project by File-> New -> Android Project name it JSonExample.

2.) Write following into main.xml file:

 

 

 

3.) Put INTERNET permission to manifest file:

 

4.) Run for output.

Steps:

1.) Create a project named JSonExample and set the information as stated in the image.

Build Target: Android 4.0
Application Name: JSonExample
Package Name: com. example. JSonExample
Activity Name: JSonExampleActivity
Min SDK Version: 14

2.) Open JSonExampleActivity.java file and write following code there:

 

 

 

3.) Compile and build the project.

Output

Comments 9

  1. Very good tutorial. The link from tutorial is not available anymore , so i tried your code with another link but i receive message ” Unfortunately JSonExampleActivity has stopped.
    What cased this error?

  2. I read your blog but there is one confusion that what is strict mode
    “StrictMode.setThreadPolicy(
    new StrictMode.ThreadPolicy.Builder().detectDiskReads().detectDiskWrites().detectNetwork().penaltyLog().build());

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">