Home » » How To Create Or Get Values Of JSON Object in JavaScript Example?

How To Create Or Get Values Of JSON Object in JavaScript Example?

Rendyon | 11:34 PM | 0 comments
JavaScript is a general purpose programming language that was introduced as the page scripting language for Netscape Navigator. JSON or JavaScript Object Notation  is a subset of the object literal notation of JavaScript. It has become a popular for defining structured data using JavaScript.

JSON supports following values:
    number (integer or floating point)
    string
    boolean
    array
    object
    null
Here is the example for creating JSON object :
var JsonObj={
'langName' : "javascript",
'notation' : "JSON",
'price': 500,
'date': "28 July 2013",
'easy' : "true"
};
JSON attributes is accessed by using '.' (dot) Operator easily.
So if we want to access langName attribute, we can access like this:

JsonObj.langName   here JsonObj (JSON object name) and langName is object attribute.
output: javascript

Similarly for price attribute:
JsonObj.price
output: 500

Check running example here:
http://jsfiddle.net/jeetu_verma11/A7t2m/9/
Share this article :

0 comments:

 
Copyright © 2011. Find Updates - All Rights Reserved
Template Modify by Creating Website
Proudly powered by Blogger