CompactJsonWriter.hpp 710 B

123456789101112131415161718192021222324252627282930
  1. // Copyright Benoit Blanchon 2014
  2. // MIT License
  3. //
  4. // Arduino JSON library
  5. // https://github.com/bblanchon/ArduinoJson
  6. #pragma once
  7. #include "JsonWriter.hpp"
  8. namespace ArduinoJson {
  9. namespace Internals {
  10. class CompactJsonWriter : public JsonWriter {
  11. public:
  12. explicit CompactJsonWriter(Print *sink) : JsonWriter(sink) {}
  13. virtual void beginArray() { _length += _sink->write('['); }
  14. virtual void endArray() { _length += _sink->write(']'); }
  15. virtual void writeColon() { _length += _sink->write(':'); }
  16. virtual void writeComma() { _length += _sink->write(','); }
  17. virtual void beginObject() { _length += _sink->write('{'); }
  18. virtual void endObject() { _length += _sink->write('}'); }
  19. };
  20. }
  21. }