A variable that can hold different type of values:

  • a boolean
  • a char, short, int or a long (signed or unsigned)
  • a string (const char*)
  • a reference to a JsonArray or JsonObject

A JsonVariant can be any of theses types at a time, but can only hold one value. Its type can change at run time.

Member functions

See also

Keep learning

Mastering ArduinoJson

The book “Mastering ArduinoJson” is the best material to learn how to use ArduinoJson.

Chapter 5 explains how ArduinoJson works from the inside. For example, it dissects the class JsonVariant and explains how it works.

Chapter 7 presents new sample project and explains how they work. For example, the project “Recursive Analyzer” extracts the content of a JsonVariant recursively, i.e., it retrieves the content of all its children.