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.


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.


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.


Leave a Comment:

krishna says July 26, 2012

hi ur blog is so good.

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?

hassan gillani says December 19, 2012

thanks alot excellent work ….keep it up 🙂

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.?

gunaseelan says December 20, 2012

Please reply me

Tanaya says December 30, 2012

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

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?

fdous says July 21, 2013

very nice blog. U are great!!

Bhadresh says October 12, 2013

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

Add Your Reply