Java JSON Tutorial - JSON Syntax

Java JSON Tutorial - JSON Syntax

JSON syntax can be summarized as follows:
  • Data is represented in name/value pairs.
  • Curly braces hold objects, the name/value pairs are separated by ,.
  • Square brackets hold arrays and values are separated by ,.
JSON supports the following two data structures:
Data structureDescription
Collection of name/value pairskey:value,key:value,
Ordered list of values[1,2,3,4]



Example

The following JSON data specifies books.
{
"book": [
{
"id":"01",
"language": "Java",
"edition": "third",
"author": "java2s.com"
},
{
"id":"02",
"language": "JSON",
"edition": "second"
"author": "java2s.com"
}]
}

Post a Comment

Previous Post Next Post