Skip to content

Instantly share code, notes, and snippets.

@bblanchon
Last active August 29, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bblanchon/f51f90794c93408d545c to your computer and use it in GitHub Desktop.
Save bblanchon/f51f90794c93408d545c to your computer and use it in GitHub Desktop.
Size of types of the Arduino JSON library
#include <ArduinoJson.h>
using namespace ArduinoJson;
#define PRINT_VALUE(X) {Serial.print(#X" =\t");Serial.println(X);}
#define PRINT_SIZE(X) {Serial.print("sizeof("#X") =\t");Serial.println(sizeof(X));}
void setup()
{
Serial.begin(9600);
PRINT_SIZE(JsonVariant);
PRINT_SIZE(StaticJsonBuffer<10>);
PRINT_SIZE(StaticJsonBuffer<20>);
PRINT_VALUE(JSON_ARRAY_SIZE(0));
PRINT_VALUE(JSON_ARRAY_SIZE(1));
PRINT_VALUE(JSON_ARRAY_SIZE(2));
PRINT_VALUE(JSON_OBJECT_SIZE(0));
PRINT_VALUE(JSON_OBJECT_SIZE(1));
PRINT_VALUE(JSON_OBJECT_SIZE(2));
}
void loop()
{
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment