What is JSON?
JSON is a human-readable text format that facilitates data interchange between different programming languages.
Here are some quick points about JSON:
- JSON is popular. JSON (JavaScript Object Notation) is quite possibly the most widely used data format for data interchange on the web. It has likely surpassed XML (which is used in AJAX applications) as the most common format used for asynchronous browser/server communication.
- JSON is a human and machine readable format. In other words, a JSON document is structured in a way that can easily be read by a computer program, while a human can usually quickly scan a JSON file and understand the data it contains.
- JSON is based on a subset of JavaScript. JSON was inspired by the object literals of JavaScript (also known as ECMAScript). However, despite this, JSON is language-agnostic. It can facilitate data interchange between most, if not all programming languages. In fact, JSON uses common programming conventions, which makes it familiar to most programmers, regardless of their chosen language/s.
What Does JSON Look Like?
Here's a basic example of a JSON document:
This is about as complex as most JSON documents will get (although most will contain a lot more data).
A JSON document contains text, curly braces, square brackets, colons, commas, double quotes, and maybe a few other characters.
But probably the most prominent thing about JSON, is that its data consists of name/value pairs. These name/value pairs reflect the structure of the data. Even if you don't know JSON, you should be able to get a basic idea of the data structure just by looking at the way data is stored in the above JSON file.
The good news is, my little example covers almost the whole JSON syntax. There's not much more to show, other than to explain how the syntax works.