Browse Source

Added links to the ArduinoJson assistant (issue #513)

Benoit Blanchon 8 years ago
parent
commit
574c00c096

+ 9 - 6
.github/ISSUE_TEMPLATE.md

@@ -1,11 +1,14 @@
 <!--
-Thanks for using ArduinoJson :-)
-
-Before opening an issue, please make sure you've read these:
+Before opening an issue, please read the FAQ:
 https://bblanchon.github.io/ArduinoJson/faq/
-https://bblanchon.github.io/ArduinoJson/doc/pitfalls/
 
-Next, make sure you provide all the relevant information: platform, code snippet, and error messages.
+Please provide all the relevant information:
+* good title
+* short description of the problem
+* target platform
+* compiler model and version
+* MVCE (https://stackoverflow.com/help/mcve)
+* compiler output
 
-Please be concise!
+Good questions get fast answers!
 -->

+ 4 - 0
README.md

@@ -58,6 +58,8 @@ double longitude   = root["data"][1];
 
 [See JsonParserExample.ino](examples/JsonParserExample/JsonParserExample.ino)
 
+Use [ArduinoJson Assistant](https://bblanchon.github.io/ArduinoJson/assistant/) to compute the buffer size.
+
 #### Encoding / Generating
 
 ```c++
@@ -78,6 +80,8 @@ root.printTo(Serial);
 
 [See JsonGeneratorExample.ino](examples/JsonGeneratorExample/JsonGeneratorExample.ino)
 
+Use [ArduinoJson Assistant](https://bblanchon.github.io/ArduinoJson/assistant/) to compute the buffer size.
+
 
 Documentation
 -------------

+ 2 - 2
examples/JsonGeneratorExample/JsonGeneratorExample.ino

@@ -17,13 +17,13 @@ void setup() {
   //
   // Inside the brackets, 200 is the size of the pool in bytes.
   // If the JSON object is more complex, you need to increase that value.
+  // See https://bblanchon.github.io/ArduinoJson/assistant/
   StaticJsonBuffer<200> jsonBuffer;
 
   // StaticJsonBuffer allocates memory on the stack, it can be
   // replaced by DynamicJsonBuffer which allocates in the heap.
-  // It's simpler but less efficient.
   //
-  // DynamicJsonBuffer  jsonBuffer;
+  // DynamicJsonBuffer  jsonBuffer(200);
 
   // Create the root of the object tree.
   //

+ 1 - 1
examples/JsonHttpClient/JsonHttpClient.ino

@@ -135,7 +135,7 @@ bool skipResponseHeaders() {
 // }
 bool readReponseContent(struct UserData* userData) {
   // Compute optimal size of the JSON buffer according to what we need to parse.
-  // This is only required if you use StaticJsonBuffer.
+  // See https://bblanchon.github.io/ArduinoJson/assistant/
   const size_t BUFFER_SIZE =
       JSON_OBJECT_SIZE(8)    // the root object has 8 elements
       + JSON_OBJECT_SIZE(5)  // the "address" object has 5 elements

+ 2 - 2
examples/JsonParserExample/JsonParserExample.ino

@@ -17,13 +17,13 @@ void setup() {
   //
   // Inside the brackets, 200 is the size of the pool in bytes,
   // If the JSON object is more complex, you need to increase that value.
+  // See https://bblanchon.github.io/ArduinoJson/assistant/
   StaticJsonBuffer<200> jsonBuffer;
 
   // StaticJsonBuffer allocates memory on the stack, it can be
   // replaced by DynamicJsonBuffer which allocates in the heap.
-  // It's simpler but less efficient.
   //
-  // DynamicJsonBuffer  jsonBuffer;
+  // DynamicJsonBuffer  jsonBuffer(200);
 
   // JSON input string.
   //

+ 4 - 2
examples/JsonServer/JsonServer.ino

@@ -2,9 +2,9 @@
 // Created by Benoit Blanchon.
 // Heavily inspired by "Web Server" from David A. Mellis and Tom Igoe
 
-#include <SPI.h>
-#include <Ethernet.h>
 #include <ArduinoJson.h>
+#include <Ethernet.h>
+#include <SPI.h>
 
 byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
 IPAddress ip(192, 168, 0, 177);
@@ -64,6 +64,8 @@ void loop() {
   if (client) {
     bool success = readRequest(client);
     if (success) {
+      // Use https://bblanchon.github.io/ArduinoJson/assistant/ to
+      // compute the right size for the buffer
       StaticJsonBuffer<500> jsonBuffer;
       JsonObject& json = prepareResponse(jsonBuffer);
       writeResponse(client, json);

+ 2 - 0
examples/JsonUdpBeacon/JsonUdpBeacon.ino

@@ -49,6 +49,8 @@ void setup() {
 void loop() {
   delay(1000);
 
+  // Use https://bblanchon.github.io/ArduinoJson/assistant/ to
+  // compute the right size for the buffer
   StaticJsonBuffer<300> jsonBuffer;
   JsonObject& json = buildJson(jsonBuffer);
   sendJson(json);