Article
    C#
    ADO.Net
    .NET
    ASP.Net & Web Forms
    Custom Controls
    Web Development
    Exception Handling
    XML
    Database
    Security in .Net
    Testing
    Web Services
    Windows Services
    Windows Controls
    WCF
    AJAX
    WPF
    XAML
    Reporting
    Setup
    VB.Net
    LINQ
    JQuery
    SilverLight
    JavaScript
    HTML5
    Crystal Report
    Cloud Computing
    Share Point
    Visual C++
    MVC
    Android
    PHP
    Java
    HTML
    WordPress
    Joomla
    Products
    Drupal
    Windows Phone
    JSON
    LightSwitch
    iPhone/iPad
    Ruby on Rails
    IIS 7
    Windows 8
    CSS/CSS3
    Excel
    MS Access
    Shortcut Keys
    Visual SourceSafe
    Team Foundation Server
    APIs
Follow Us
Follow _MindStick_ on Twitter View MindStick Software's LinkedIn profile View MindStick Software's Facebook profile
Top Contributor
Advertisement
Advertise with Us
Mindstick
Article Article  Forum Forum  Blog Blog  Quiz Quiz  Beginner Beginner  Careers Careers  Contact Contact  Login Login  
Home | Product | Services | About Us | Interview | DeveloperSection | Submit an Article | Submit Blog

Home >> JSON >> Structure and Data Types of JSON
Structure and Data Types of JSON
Structure and Data Types of JSON


by Arun Singh on 5/8/2012 4:18:16 PM

Views: 1367       Comments: 0

Structure and Data Types of JSON

This article is going to explain what structure used in JSON and you will also learn different form storing data in JSON (JavaScript Object Notation).

Data Structures supported by JSON:

JSON supports two widely used (amongst programming languages) data structures.

A collection of name/value pairs:

Different programming languages support this data structure in different names. Like object, record, struct, dictionary, hash table, keyed list, or associative array.

An ordered list of values:

 In various programming languages, it is called as array, vector, list, or sequence.

Since data structure supported by JSON is also supported by most of the modern programming languages, it makes JSON a very useful data-interchange format.

Data Types in JSON:

JSON supports an array of data types. We will discuss those in detail in the following section of this page of the JSON tutorial.

Object:

An object starts and ends with '{' and '}'. Between them, a number of string value pairs can reside. String and value is separated by a ':' and if there are more than one string value pairs, they are separated by ','.

Syntax:  {string: value, ………}

Example:

{

"firstName": "Arun Kumar ",

"lastName": " Singh",

"age": 22,

"email":"xyz@domain_name.com"

}

 

Array:

If the JSON data describes an array and each element of that array is an object.

[
{
"name": " Arun Kumar ",
"email": " xyz@domain_name.com "
},
{
"name": "Kumar Vishu",
"email": " xyz@domain_name.com "
}
]

Remember that even arrays can also be nested within an object. The following shows that.

{
"name": " Arun Kumar ",
"email": “xyz@domain_name.com”,
"age": 22,
"phoneNumber":
[
{
"type": "personal",
"number": "000000000"
},
{
"type": "fax",
"number": "000-0000-0000"
}
]
}

 

Value:

A value can be a string, a number, an object, an Array, an Boolean value (i.e. true or false) or Null. This structure can be nested.

Syntax:

String || Number || Object ||Array || Boolean || NULL

String:

A string is a sequence of zero or more Unicode characters, enclosed by double quotes, using backslash escapes.

Number:

There are two types number in JSON; Integer and floating number.

Whitespace:

Whitespace can be placed between any pair of supported data-types.

Report Abuse Form
Reason:    
 

Title :
Comment :
Text ColorBackground Color
BoldItalicUnderline
LeftCenterRightJustify
Ordered ListBulleted List
IndentOutdent
Horizontal Rule
SubscriptSuperscript
HyperlinkImage
Design ModeDesign
View HtmlHtml
     
 
Latest Article by Arun SinghRSS Feed
    
    
    
    
    
    
    
    
    
    
More...
Latest BlogsRSS Feed
    
    
    
    
    
    
    
    
    
    
More...
Top Viewed ArticlesRSS Feed
    
    
    
    
    
    
    
    
    
    
Top Viewed BlogsRSS Feed
    
    
    
    
    
    
    
    
    
    
Latest Interview QuestionsRSS Feed
    
    
    
    
    
    
    
    
    
    
More...
Total Online Users: 5201
Advertisement
MindStick Cleaner
Advertise with Us
  
Copyright © 2009 - 2013MindStick. All Rights Reserved.