Home > Article > Web Front-end > Graphical introduction to the five major elements of JSON syntax_Basic knowledge
JSON syntax is a lightweight data exchange format. Easy for humans to read and write. At the same time, it is also easy to be parsed and generated by machines. Let’s study and study it below. I hope this article can teach you more things.
JSON syntax development content includes: easier design integration, expanded deployment options, richer login and personalization services, and better data access and synchronization. You can also use json_encode() to make database connections from PHP The data can be used in Ajax applications.
JSON syntax
The syntax of JSON is very simple, just use braces '{}', square brackets '[]', commas ', ', colon ':', double quotes '""'. Data type: nested object, array, string, number, boolean, or null.
1) An object is an unordered collection of "name/value pairs". An object starts with "{" (left bracket) and ends with "}" (right bracket). Each "name" is followed by a ":" (colon); "name/value" pairs are separated by a "," (comma).
2) An array is an ordered collection of values. An array starts with "[" (left bracket) and ends with "]" (right bracket). Values are separated by "," (comma).
3) JSON syntax can be a string, number, true, false, null, object or array enclosed in double quotes. These structures can be nested.
4) A string is a collection of any number of Unicode characters surrounded by double quotes and escaped with backslashes. A character is a single character string. Strings are very similar to C or Java strings.
5) JSON syntax is also very similar to C or Java numerical values. Remove unused octal and hexadecimal formats. Removed some encoding details.