JsonBuffer is the entry point for using the library: it handles the memory management and calls the parser.

It implements a speed efficient memory pool and comes in two flavors:

  1. DynamicJsonBuffer which is allocated on the heap and grows automatically
  2. StaticJsonBuffer which is (most likely) allocated on the stack and has a fixed size.

JsonBuffer is optimized of fast allocation, but doesn’t allow to free the allocated memory block. To free a JsonBuffer, you must discard the entire object.

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. It explains why the class JsonBuffer is crucial for the performance of the library. It dissects StaticJsonBuffer and DynamicJsonBuffer, shows the differences between the two, and tells how to choose between them.

Chapter 6 is a troubleshooting guide that helps you get out of every difficult situation.