瀏覽代碼

Remove mentions of the zero-copy mode

Benoit Blanchon 2 年之前
父節點
當前提交
7bd2ea1072

+ 1 - 2
README.md

@@ -17,7 +17,6 @@ ArduinoJson is a C++ JSON library for Arduino and IoT (Internet Of Things).
 
 * [JSON deserialization](https://arduinojson.org/v6/api/json/deserializejson/)
     * [Optionally decodes UTF-16 escape sequences to UTF-8](https://arduinojson.org/v6/api/config/decode_unicode/)
-    * [Optionally stores links to the input buffer (zero-copy)](https://arduinojson.org/v6/api/json/deserializejson/)
     * [Optionally supports comments in the input](https://arduinojson.org/v6/api/config/enable_comments/)
     * [Optionally filters the input to keep only desired values](https://arduinojson.org/v6/api/json/deserializejson/#filtering)
     * Supports single quotes as a string delimiter
@@ -104,7 +103,7 @@ ArduinoJson is a C++ JSON library for Arduino and IoT (Internet Of Things).
 Here is a program that parses a JSON document with ArduinoJson.
 
 ```c++
-char json[] = "{\"sensor\":\"gps\",\"time\":1351824120,\"data\":[48.756080,2.302038]}";
+const char* json = "{\"sensor\":\"gps\",\"time\":1351824120,\"data\":[48.756080,2.302038]}";
 
 JsonDocument doc;
 deserializeJson(doc, json);

+ 2 - 10
extras/scripts/wandbox/JsonGeneratorExample.cpp

@@ -9,25 +9,18 @@
 
 int main() {
   // Allocate the JSON document
-  //
-  // Inside the parentheses, 200 is the RAM allocated to this document.
-  // Don't forget to change this value to match your requirement.
-  // Use https://arduinojson.org/v6/assistant to compute the capacity.
   JsonDocument doc;
 
-  // Add values in the document
-  //
+  // Add values in the document.
   doc["sensor"] = "gps";
   doc["time"] = 1351824120;
 
-  // Add an array.
-  //
+  // Add an array
   JsonArray data = doc["data"].to<JsonArray>();
   data.add(48.756080);
   data.add(2.302038);
 
   // Generate the minified JSON and send it to STDOUT
-  //
   serializeJson(doc, std::cout);
   // The above line prints:
   // {"sensor":"gps","time":1351824120,"data":[48.756080,2.302038]}
@@ -36,7 +29,6 @@ int main() {
   std::cout << std::endl;
 
   // Generate the prettified JSON and send it to STDOUT
-  //
   serializeJsonPretty(doc, std::cout);
   // The above line prints:
   // {

+ 5 - 16
extras/scripts/wandbox/JsonParserExample.cpp

@@ -9,33 +9,22 @@
 
 int main() {
   // Allocate the JSON document
-  //
-  // Inside the parentheses, 200 is the capacity of the memory pool in bytes.
-  // Don't forget to change this value to match your JSON document.
-  // Use https://arduinojson.org/v6/assistant to compute the capacity.
   JsonDocument doc;
 
-  // JSON input string.
-  //
-  // Using a char[], as shown here, enables the "zero-copy" mode. This mode uses
-  // the minimal amount of memory because the JsonDocument stores pointers to
-  // the input buffer.
-  // If you use another type of input, ArduinoJson must copy the strings from
-  // the input to the JsonDocument, so you need to increase the capacity of the
-  // JsonDocument.
-  char json[] =
+  // JSON input string
+  const char* json =
       "{\"sensor\":\"gps\",\"time\":1351824120,\"data\":[48.756080,2.302038]}";
 
   // Deserialize the JSON document
   DeserializationError error = deserializeJson(doc, json);
 
-  // Test if parsing succeeds.
+  // Test if parsing succeeds
   if (error) {
     std::cerr << "deserializeJson() failed: " << error.c_str() << std::endl;
     return 1;
   }
 
-  // Fetch values.
+  // Fetch the values
   //
   // Most of the time, you can rely on the implicit casts.
   // In other case, you can do doc["time"].as<long>();
@@ -44,7 +33,7 @@ int main() {
   double latitude = doc["data"][0];
   double longitude = doc["data"][1];
 
-  // Print values.
+  // Print the values
   std::cout << sensor << std::endl;
   std::cout << time << std::endl;
   std::cout << latitude << std::endl;

+ 5 - 17
extras/scripts/wandbox/MsgPackParserExample.cpp

@@ -9,17 +9,9 @@
 
 int main() {
   // Allocate the JSON document
-  //
-  // Inside the parentheses, 300 is the size of the memory pool in bytes.
-  // Don't forget to change this value to match your JSON document.
-  // Use https://arduinojson.org/assistant to compute the capacity.
   JsonDocument doc;
 
-  // MessagePack input string.
-  //
-  // It's better to use a char[] as shown here.
-  // If you use a const char* or a String, ArduinoJson will
-  // have to make a copy of the input in the JsonBuffer.
+  // The MessagePack input string
   uint8_t input[] = {131, 166, 115, 101, 110, 115, 111, 114, 163, 103, 112, 115,
                      164, 116, 105, 109, 101, 206, 80,  147, 50,  248, 164, 100,
                      97,  116, 97,  146, 203, 64,  72,  96,  199, 58,  188, 148,
@@ -31,20 +23,16 @@ int main() {
   //   "data": [48.75608, 2.302038]
   // }
 
-  // doc of the object tree.
-  //
-  // It's a reference to the JsonObject, the actual bytes are inside the
-  // JsonBuffer with all the other nodes of the object tree.
-  // Memory is freed when jsonBuffer goes out of scope.
+  // Parse the input
   DeserializationError error = deserializeMsgPack(doc, input);
 
-  // Test if parsing succeeds.
+  // Test if parsing succeeds
   if (error) {
     std::cerr << "deserializeMsgPack() failed: " << error.c_str() << std::endl;
     return 1;
   }
 
-  // Fetch values.
+  // Fetch the values
   //
   // Most of the time, you can rely on the implicit casts.
   // In other case, you can do doc["time"].as<long>();
@@ -53,7 +41,7 @@ int main() {
   double latitude = doc["data"][0];
   double longitude = doc["data"][1];
 
-  // Print values.
+  // Print the values
   std::cout << sensor << std::endl;
   std::cout << time << std::endl;
   std::cout << latitude << std::endl;

+ 1 - 1
idf_component.yml

@@ -1,7 +1,7 @@
 version: "7.0.0-alpha"
 description: >-
   A simple and efficient JSON library for embedded C++.
-  ArduinoJson supports ✔ serialization, ✔ deserialization, ✔ MessagePack, ✔ zero-copy, ✔ streams, ✔ filtering, and more.
+  ArduinoJson supports ✔ serialization, ✔ deserialization, ✔ MessagePack, ✔ streams, ✔ filtering, and more.
   It is the most popular Arduino library on GitHub ❤❤❤❤❤.
   Check out arduinojson.org for a comprehensive documentation.
 url: https://arduinojson.org/

+ 1 - 1
library.json

@@ -1,7 +1,7 @@
 {
   "name": "ArduinoJson",
   "keywords": "json, rest, http, web",
-  "description": "A simple and efficient JSON library for embedded C++. ArduinoJson supports ✔ serialization, ✔ deserialization, ✔ MessagePack, ✔ zero-copy, ✔ streams, ✔ filtering, and more. It is the most popular Arduino library on GitHub ❤❤❤❤❤. Check out arduinojson.org for a comprehensive documentation.",
+  "description": "A simple and efficient JSON library for embedded C++. ArduinoJson supports ✔ serialization, ✔ deserialization, ✔ MessagePack, ✔ streams, ✔ filtering, and more. It is the most popular Arduino library on GitHub ❤❤❤❤❤. Check out arduinojson.org for a comprehensive documentation.",
   "homepage": "https://arduinojson.org/?utm_source=meta&utm_medium=library.json",
   "repository": {
     "type": "git",

+ 1 - 1
library.properties

@@ -3,7 +3,7 @@ version=7.0.0-alpha
 author=Benoit Blanchon <blog.benoitblanchon.fr>
 maintainer=Benoit Blanchon <blog.benoitblanchon.fr>
 sentence=A simple and efficient JSON library for embedded C++.
-paragraph=ArduinoJson supports ✔ serialization, ✔ deserialization, ✔ MessagePack, ✔ zero-copy, ✔ streams, ✔ filtering, and more. It is the most popular Arduino library on GitHub ❤❤❤❤❤. Check out arduinojson.org for a comprehensive documentation.
+paragraph=ArduinoJson supports ✔ serialization, ✔ deserialization, ✔ MessagePack, ✔ streams, ✔ filtering, and more. It is the most popular Arduino library on GitHub ❤❤❤❤❤. Check out arduinojson.org for a comprehensive documentation.
 category=Data Processing
 url=https://arduinojson.org/?utm_source=meta&utm_medium=library.properties
 architectures=*