Skip to content

JSON HOME

JSON: JavaScript Object Notation. JSON is a lightweight, text-based format for storing and exchanging data. JSON is often used when data is sent from a server to a web page, serving as a popular alternative to XML.

The following example shows JSON data representing an employees object, which contains an array of three employee records:

{
"employees": [
{
"firstName": "Alice",
"lastName": "Green"
},
{
"firstName": "Bob",
"lastName": "Smith"
},
{
"firstName": "Charlie",
"lastName": "Brown"
}
]
}

For comparison, the same data structure represented in XML might look like this:

<employees>
<employee>
<firstName>Alice</firstName>
<lastName>Green</lastName>
</employee>
<employee>
<firstName>Bob</firstName>
<lastName>Smith</lastName>
</employee>
<employee>
<firstName>Charlie</firstName>
<lastName>Brown</lastName>
</employee>
</employees>

Notice that the JSON version is generally more concise.

  • JSON stands for JavaScript Object Notation.
  • It is a lightweight data-interchange format.
  • It is language independent*, meaning it can be used with most modern programming languages.
  • It is considered “self-describing” and relatively easy for humans to understand.
*JSON uses JavaScript syntax conventions, but the format itself is purely text. Any programming language capable of processing text can parse and generate JSON data.

JSON is commonly used for:

  • Transmitting data between a server and web application (APIs).
  • Configuration files.
  • Storing unstructured data in some databases.