JSON Data types and Example

The following are the Basic JSON Data types,

  • Number : integer, real, or floating point
  • String : double-quoted Unicode with backslash escaping
  • Boolean : true and false
  • Array : an ordered sequence of values, comma-separated and enclosed in square brackets
  • Object : collection of key:value pairs, comma-separated and enclosed in curly braces
  • null

Example

{
"firstName": "Praveen",
"lastName": "C",
"address": {
"streetAddress": "KK Nagar",
"city": "Chennai",
"state": "TN",
"postalCode": 6310102
},
"phoneNumbers": [
"091 98943 37266"
]
}

What is JSON?

JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate. It is based on a subset of the JavaScript Programming Language, Standard ECMA-262 3rd Edition – December 1999. 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.