JsonBuffer
Description
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:
DynamicJsonBuffer
which is allocated on the heap and grows automaticallyStaticJsonBuffer
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
JsonBuffer::clear()
JsonBuffer::createArray()
JsonBuffer::createObject()
JsonBuffer::parse()
JsonBuffer::parseArray()
JsonBuffer::parseObject()
JsonBuffer::size()
JsonBuffer::strdup()
See also
- Serialization tutorial
- Deserialization tutorial
- How to reuse a JsonBuffer?
- What are the differences between StaticJsonBuffer and DynamicJsonBuffer?
- How to determine the buffer size?
- Why shouldn’t I use a global JsonBuffer?
- What are the common sizes for JsonBuffer?
Keep learning
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.