Published on

JSON

Authors
  • Name
    Jackson Chen

JSON

JavaScript Object Notation

JSON introduction

https://www.w3schools.com/js/js_json_intro.asp

https://attacomsian.com/blog/what-is-json

https://www.tutorialspoint.com/json/json_quick_guide.htm

JSON is self-describing and easy to understand.

JSON Syntax

https://www.w3schools.com/js/js_json_syntax.asp

JSON syntax is derived from JavaScript object notation syntax:

Data is in name/value pairs
Data is separated by commas
Curly braces hold objects
Square brackets hold arrays

JSON data types

https://www.w3schools.com/js/js_json_datatypes.asp

In JSON, values must be one of the following data types:

a string
a number
an object (JSON object)
an array
a boolean
null

JSON Parse

A common use of JSON is to exchange data to/from a web server. When receiving data from a web server, the data is always a string.

# Use the JavaScript function JSON.parse() to convert text into a JavaScript object:
const obj = JSON.parse('{"name":"John", "age":30, "city":"New York"}');