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

Leave a Comment:

9 comments
krishna says July 26, 2012

hi ur blog is so good.

Reply
cv says December 8, 2012

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?

Reply
hassan gillani says December 19, 2012

thanks alot excellent work ….keep it up 🙂

Reply
gunaseelan says December 20, 2012

Can you give us a source code in android which reads a json file from the local disk and manipulate in a list view.?

Reply
gunaseelan says December 20, 2012

Please reply me

Reply
Tanaya says December 30, 2012

Hi i want to link android to mysql database thr netbeans, wil u please help me

Reply
trubi says February 12, 2013

What is the difference between algorithm and steps. If the steps are what you have to do, where do you create main.xml?

Reply
fdous says July 21, 2013

very nice blog. U are great!!

Reply
Bhadresh says October 12, 2013

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());

Reply
Add Your Reply