JSON - JavaScript Object Notation - Most popular and widely accepted data exchange format - originally specified by Douglas Crockford.
• easy to use & purely text-based, lightweight, and human-readable format
• platform and language independent and inbuilt supported by almost all of the front-line languages/frameworks
• official MIME type for JSON text is application/json
• file name extension - .json
Syntax Rules
• Data is in name/value pairs
• Data is separated by commas
• Curly braces hold objects
• Square brackets hold arrays
Parsing JSON string - Parse the data with JSON.parse(), and the data becomes a JavaScript object.
When sending data to a web server, the data has to be a string.
Convert a JavaScript object into a string with JSON.stringify().
Common Problems
| Trailing Comma - your are not allowed to add a trailing comma
| Missing Comma - Since trailing commas are not allowed, it is easy to forget to append one before adding a new value
| Comments - JSON does not allow comments as it is a data-interchange format.