The Grammar - Espressif ESP8266 User Manual

Hide thumbs Also See for ESP8266:
Table of Contents

Advertisement

B. The Grammar
The following image describes the grammar of a valid JSON object in a very concise way.
It means that a JSON object knows three basic types:
object
array and
value
Objects always start and end with curly brackets. They can be either empty (line to the top)
or contain string/value pairs, separated by a colon. These pairs can be repeated by adding a
comma between them. Arrays start and end with square brackets. They can be either empty
or contain a value. At this point we don't know yet what a value is. Values in an array can be
repeated and must be separated by a comma. Values were already used for the two previous
definitions and here lies the power of this kind of grammar: because a value can contain a
simple text, a number, an object (yes, the object we defined before!!!), an array (also defined
before), booleans or a null value.
This is so powerful because we are reusing the definitions and we are nesting them within
each other: an object can contain a value; a value can contain an array or an object. And
finally, an array can contain a value, repeatedly! Isn't this beautiful?
JSON grammar

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ESP8266 and is the answer not in the manual?

Questions and answers

Table of Contents

Save PDF