Curriculum
Course: JavaScript Basic
Login

Curriculum

JavaScript Basic

JSHome

0/216
Text lesson

JS JSON

JSON is a format used for storing and transmitting data.

It is commonly used to send data from a server to a web page.

What is JSON?

  • JSON stands for JavaScript Object Notation.
  • It is a lightweight format for data interchange.
  • JSON is language-independent.
  • JSON is “self-describing” and easy to understand.

Although JSON syntax is based on JavaScript object notation, it is a text-based format. Code for reading and generating JSON data can be written in any programming language.

JSON Example

This JSON syntax defines an employees object, which is an array containing three employee records (objects).

JSON Example

{
“employees”:[
  {“firstName”:“John”“lastName”:“Doe”},
  {“firstName”:“Anna”“lastName”:“Smith”},
  {“firstName”:“Peter”“lastName”:“Jones”}
]
}

The JSON Format Evaluates to JavaScript Objects

The JSON format is syntactically identical to the way JavaScript objects are created.

Due to this similarity, a JavaScript program can easily convert JSON data into native JavaScript objects.