Skip to main content

JSON Basics

JSON: JavaScript Object Notation
A Great Implementation in HTML5 Game Development.

If you are a game developer then JSON is a very important name in your kitty. JSON basically originated from the JavaScript. It is represented with the two primary data structures i.e. Order List (Array) and Objects pairs. JSON is a light-weight text oriented data-interchange format. It is easy to implement as compare to XML. It is widely use format over the WWW.
JSON is language independent and its data structure, array and objects are universality accepted. These structures are supported in some way by most of the modern programming languages like Python, Perl, ASP, ABAP, C, C++, C#, Lisp, COBOL, Ruby, Java, PL/SQL, Objective C, and many more.

Basics of JSON:

1.      Object: In this values are separated by comma (,). Property of these objects can be accessed by its object name followed by property  name or by using array.
                   Example:       
                   myObj1 = {                                       //Object myObj1 Created
                                      "first": "Raj",
                                      "last": "Singh",              //Values separated
                                      "age": 29,                     //by comma (,)
                                      "sex": "M",
                                      "salary": 30000,
                                      "favourites":  {        //Object nested with object
                                      "color": "grey",
                                      "sport": "cricket",
                                                            } 
                                      "passion": [ "Music", "Biking" ]
                                                                                  //Object nested with object
 
                                   } 
 Access these values:
·         myObj1.last à Singh (Output)
·         myObj1[“first”] à Raj (Output)
·         myObj1.favourites.sport à cricket (Output)
·         myObj1[“favourites”][“sport”] à cricket (Output)
·         myObj1[“passion”][0] à Music (Output)
·         myObj1. passion [0] à Music (Output)

2.      Array : Elements of the array are of types (number, Boolean or null, String).
                  Example:

myArray1 = [“Raj", 32, music, null]     // Array created
                               
                        myArray2 = [   
                                            {"name": "Vijay", "age": 26}, 
                                           {“name": "Sneha", "age": 25} //Array with objects
                                             ]

Access these values

·         myArray1 [2] à music (Output)
·         myArray2 [1].name à Sneha (Output)

3.      Datatypes used in JSON Implementation

·         Number
Declaration:
var myNum1 = 123.456
Definition: Double-precision floating-point format.

·         Stringvar
Declaration:
myString1="abcde##132jhdff"
Definition: Series of characters (letters, numbers, or symbols); double-quoted UTF-8 with backslash escaping.

·         Boolean
Declaration:
var myBool1 = true
Definition:  One of two values: true or false.

·         Arrayvar
Declaration:
myArray1 = [ "a", "x", "t", "d" ]
Definition: Sequence of values, comma-separated and enclosed in square brackets; values don't need to be of the same type.

·         Objectvar
Declaration:
myObject1 = { "number":86 }
Definition: Unordered collection of key/value pairs; comma-separated and enclosed in curly braces; the should be strings and be distinct.
·         Nullvar
Declaration:
myNul1= null
Definition: Empty

Comments

Popular posts from this blog

Inter-Organizational Value Chain

The value chain of   a company is part of over all value chain. The over all competitive advantage of an organization is not just dependent on the quality and efficiency of the company and quality of products but also upon the that of its suppliers and wholesalers and retailers it may use. The analysis of overall supply chain is called the value system. Different parts of the value chain 1.  Supplier     2.  Firm       3.   Channel 4 .   Buyer
Advantages and Disadvantages of EIS Advantages of EIS Easy for upper-level executives to use, extensive computer experience is not required in operations Provides timely delivery of company summary information Information that is provided is better understood Filters data for management Improves to tracking information Offers efficiency to decision makers Disadvantages of EIS System dependent Limited functionality, by design Information overload for some managers Benefits hard to quantify High implementation costs System may become slow, large, and hard to manage Need good internal processes for data management May lead to less reliable and less secure data

System Analysis and Design (SAD)

Introduction to System Analysis and Design (SAD) System are created to solve Problems. One can think of the systemsapproch as an organised way of dealing with a problem. In this dynamic world , the subject system analysis and design, mainly deals with the software development activities. This post include:- What is System? What are diffrent Phases of System Development Life Cycle? What are the component of system analysis? What are the component of system designing? What is System? A collection of components that work together to realize some objectives forms a system. Basically there are three major components in every system, namely input, processing and output. In a system the different components are connected with each other and they are interdependent. For example, human body represents a complete natural system. We are also bound by many national systems such as political system, economic system, educational system and so forth. The objective of the system demands tha...