Posted By Our Mentors
Amreen Khan
Android Developer
animesh bansal
iphone App Developer
Devendra chouksey
Android Developer
Dilip Saket
IOS apps developer
Hemraj Jhariya
iOS Developer
Jaihind singh Rajput
Smart Phone App Dev
Mujahid khan
Android developer
Narendra Yadav
android developer
Narinder Gupta
Mobile App Architect
Pradeep singh Thakur
Mobile App Architect
Sanjay Sharma
Andriod Developer
Shakti Rajpal
IT Architect
Soniya Vishwakarma
iPhone App Developer
Sunil Raghuwanshi
iPhone App Developer
Supriya Kapse
Senior developer
View current Topics
How to generate and parse data in JSON format in Android Android
JSON (JavaScript Object Notation) is a lightweight computer data interchange format. It is a text-based, human-readable format for representing simple data structures and associative arrays (called objects).
Posted By: Mujahid khan Date: 17 Jul 2012 View: 1121
      Rate This !!


The JSON format is often used for transmitting structured data over a network connection in a process called serialization. JSON can be seen as an alternative to the traditional use of the XML format and is better and faster than XML.

Supported data types :

  1. Number (integer, real, or floating point)
  2. String (double-quoted Unicode with backslash escapement)
  3. Boolean (true and false)
  4. Array (an ordered sequence of values, comma-separated and enclosed in square brackets)
  5. Object (collection of key/value pairs, comma-separated and enclosed in curly brackets)
  6. Null

 

Syntax

The following example shows the JSON representation of an object that describes a person. The object has string fields for first name , last name and age, contains a list of phone numbers (an array).

 

{

"tel_nos":["007","008"],

"surname":"khan",

"age":"25 yrs",

"name":"Mujahid"

}

 

 

In this article, we are going to see how we can generate an Array containing JSON objects and how to parse it. This article assumes that you have basic knowledge of java programming language and programming in Android too. The code here is pretty self explanatory and inline comments are provided where I felt are required to make the code easy to grasp. Full running project along with source is available to download from the link below. Any queries and suggestions are most welcome.

 

Regards,

Mujahid Hussain Khan


Posted Queries
Posted By: sanjay sharma Reply:How to generate and parse data in JSON forma
19 Jul 2012
Very nice post it i am a biggner in JSON and its really help me a lot. thanks to Mr. Mujahid for a nice simple and easy article.