JSON
JSONStreamWriter
You can use JSONStreamWriter
to write JSON directly to a Stream
that implements the Print
interface.
You can use this technique to write JSON directly to a TCPClient
for example, without buffering in RAM. This is useful for very large objects, however it's generally more efficient to buffer reasonably-sized objects in RAM and write them in a single write()
instead of byte-by-byte.
JSONStreamWriter::JSONStreamWriter(Print &stream)
// PROTOTYPE
JSONStreamWriter(Print &stream);
Constructs a JSONWriter
that writes to a Print
interface.
JSONStreamWriter::stream()
// PROTOTYPE
Print* stream() const;
Returns the stream you passed to the constructor.