What Is JSON?

What Is JSON?

JSON is a data-interchange format, which is easy to read and write and also easy to parse and generate by a machine. The JSON text format is a language format that is language independent but makes use of conventions familiar to commonly used languages such as Java, C, and JavaScript.

Essentially a JSON document is an object, a collection of name/value pairs enclosed in curly braces {}. Each name in the collection is followed by ‘:’ and each subsequent name/value pair is separated from the preceding by a ','. An example of a JSON document is as follows in which attributes of a catalog are specified as name/value pairs.

{

   "journal":"Oracle Magazine",

   "publisher":"Oracle Publishing",

   "edition": "January February 2013"

}

The name in name/value pairs must be enclosed in double quotes "". The value must also be enclosed in "" if a string includes at least a single character. The value may have one of the types discussed in Table 1-2.

Table 1-2. JSON Data Types

Type

Description

Example

string

A string literal. A string literal must be enclosed in "".

{

"c1":"v1",
"c2":"v2"

}

The string may consist of any Unicode character except " and \. Each value in the following JSON document is not valid.

 

{

"c1":""",
"c2":"\"

}

The following JSON document is valid.

{

"c1":"\"",
"c2":"\\"

}

number

A number may be positive or negative, integer or decimal.

{

"c1": 1,
"c2": -2.5,
"c3":0

}

array

An array is a list of values enclosed in [].

{

"c1":[1,2,3,4,5,"v1","v2"],
"c2":[-1,2.5,"v1",0]

}

true false

The value may be a Boolean true or false.

{

"c1":true,
"c2":false

}

null

The value may be null.

{

"c1":null,
"c2":null

}

object

The value may be another JSON object.

{

"c1":{"a1":"v1", "a2":"v2", "a3":[1,2,3]},
"c2":{"a1":1, "A2":null, "a3":true},
"c3":{}

}

The JSON document model is most suitable for storing unstructured data, as the JSON objects can be added in a hierarchical structure creating complex JSON documents. For example, the following JSON document is a valid JSON document consisting of hierarchies of JSON objects.

{

  "c1": "v1",
  "c2": {

          "c21":[1,2,3],
          "c22":
               {

               "c221":"v221",
               "c222":
                     {

                      "c2221":"v2221"

                     },
               "c223":
                     {
 
                      "c2231":"v2231"

                     }

              }

          }
}

 

 

Вас заинтересует / Intresting for you:

CASES of Use of NON-Fungible T...
CASES of Use of NON-Fungible T... 469 views Zero Cool Wed, 09 Feb 2022, 18:19:06
TOP-10 Platform to sell NFT an...
TOP-10 Platform to sell NFT an... 715 views Zero Cool Thu, 10 Feb 2022, 13:11:05
How to create NFTs (NON-Fungib...
How to create NFTs (NON-Fungib... 583 views Zero Cool Thu, 10 Feb 2022, 13:53:20
Which matrix is ​​better than ...
Which matrix is ​​better than ... 1872 views Андрей Васенин Sun, 26 Dec 2021, 06:28:46
Comments (0)
There are no comments posted here yet
Leave your comments
Posting as Guest
×
Suggested Locations