Learn How to Use JSON

In this section We cover

What is JSON?

JSON: JavaScript Object Notation.
JSON is a syntax for storing and exchanging data.
JSON is text, written with JavaScript object notation.
  • When exchanging data between a browser and a server, the data can only be text.
  • JSON is text, and we can convert any JavaScript object into JSON, and send JSON to the server.
  • We can also convert any JSON received from the server into JavaScript objects.
  • This way we can work with the data as JavaScript objects, with no complicated parsing and translations.
  • If you have data stored in a JavaScript object, you can convert the object into JSON, and send it to a server
  • If you receive data in JSON format, you can convert it into a JavaScript object

JSON uses JavaScript syntax, but the JSON format is text only. Text can be read and used as a data format by any programming language. Since the JSON format is text only, it can easily be sent to and from a server, and used as a data format by any programming language. JavaScript has a built in function to convert a string, written in JSON format, into native JavaScript objects: