In this esp32 tutorial, we will check how to convert an object to a JSON string using Espruino on the ESP32.
Espruino also makes available the JSON object, so we will take advantage of its stringify method in the code below to convert some objects into JSON strings.
Note however that, at the time of writing, there are some diferences between Espruino’s implementation and the standard implementation of the stringify method, as can be seen in this source file.
One important thing to be mentioned is that the stringify method will only be able to convert to a JSON string the attributes of the object that can be represented accordingly to the JSON standard. For example, if an object has an attribute that is a function, then it will not be serialized.