An introduction to JSON

JSON => JavaScript Object Notation

JSON is a language independent, object interchange format. JSON is a text format that is completely language independent but uses conventions that are familiar to programmers of the C-family of languages, including C, C++, C#, Java, JavaScript, Perl, Python, and many others. These properties make JSON an ideal data-interchange language.

JSON Consists of 2-structures
  1. collection of Name / Value pairs which is implemented in languages as Dictionary or HashTable
  2. ordered list of Values, which is implemented in languages as Arrays or Collections



Object: It is collection of unordered list of Name:Value pairs. In the notation it starts with '{' and ends with '}'. In the braces it contains collection of name-value pairs. Name value pairs are notated as Name:Value. Each Name:Value pairs are separated by ,.








Array: It is collection of ordered list of Values. In notation it starts with '[' and ends with ']'. In between the brackets there are Values. Each Value in Array are separated by ",".








Value: It can be Array,object,string,boolean value, number or null value.




















String: It is set of valid unicode-charecters and special characters (Except '\')

















Number: It is similar to the numbers in languages like c,java,C# etc.

Notations
Object: {}
             {Members}
Member: Pair
                Pair,Members
Pair: String : Value
Array: []
            [Elements]
Elements: Value
                 Value, Elements
Value: String,
            Number,
            Object,
            Array,
            True,
            False,
            Null
                                                                   
String: Chars
Chars: Char, Chars
Char: Valid Unicode-Chars
          \" (Double Quote)
          \\ (Back Slash)
          \b (backspace)
     \f(formfeed)
     \n(new line)
     \r(carriage return)
     \t(tab)
     \u[xxxx]  Hex values
                                     

Number: Int
        Int Fractional
        Exp
        Fractional Exp
        Int Fractional Exp
                                     

Int: Digits (0 to 9)
    -Digits

Fractional: .Digits

Exp: e Digits

Digits: Digit
        Digits
     

No comments:

Post a Comment