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

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

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

Big-M Method and Two-Phase Method

Big-M Method The Big-M method of handling instances with artificial  variables is the “commonsense approach”. Essentially, the notion is to make the artificial variables, through their coefficients in the objective function, so costly or unprofitable that any feasible solution to the real problem would be preferred, unless the original instance possessed no feasible solutions at all. But this means that we need to assign, in the objective function, coefficients to the artificial variables that are either very small (maximization problem) or very large (minimization problem); whatever this value,let us call it Big M . In fact, this notion is an old trick in optimization in general; we  simply associate a penalty value with variables that we do not want to be part of an ultimate solution(unless such an outcome is unavoidable). Indeed, the penalty is so costly that unless any of the  respective variables' inclusion is warranted algorithmically, such variables will ...