JSON Format Syntax

Q

What is the JSON format syntax? I heard that it is very simple.

✍: FYIcenter.com

A

JSON format syntax is very simple. It can be summarized below:

1. A JSON text string contains a single JSON Value.

2. A single JSON Value must be one of the following:

  • JSON String - A quoted sequence of Unicode characters represented as in this example: "Hello World!".
  • JSON Number - A decimal number represented in the scientific notation as in this example: 0.314159e+1.
  • JSON Boolean - One of the two key words: true and false.
  • JSON Null - The key word: null
  • JSON Array - An ordered list of JSON values represented as in this example: ["Hello", 3.14, true, {"name": "Joe", "age": null}].
  • JSON Object - An unordered collection list of JSON String and JSON Value pairs represented as in this example: {"name": "Joe", "age": null}.

3. A Unicode character is any printable ASCII character (except " and \) or one of following escape sequences:

\" - Representing double quote, same as \u0022
\\ - Representing backward slash, same as \u005c
\/ - Representing forward slash, same as \u005f
\b - Representing backspace, same as \u0008
\f - Representing form feed, same as \u000c
\n - Representing new line, same as \u000a
\r - Representing carriage return, same as \u000d
\t - Representing tab, same as \u0009
\uxxxx - Representing any Unicode character with its code point specified 
     as 4 hex digits xxxx as in this example: \u263a
\  - Representing nothing, if not followed with an escape sequence

4. All whitespace character sequences outside JSON String are considered as a single space character.

 

Examples of Invalid JSON Values

JSON Text String Example

Introduction of JSON

⇑⇑ JSON Tutorials

2023-04-13, 2077🔥, 0💬