File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 66
77* Fix conversion from static string to number
88* Slightly reduce code size
9+ * Optimize storage of static strings
10+
11+ > ### BREAKING CHANGES
12+ >
13+ > Static string cannot contain NUL characters anymore (they could since 7.3.0).
14+ > This is an extremely rare case, so you probably won't be affected.
15+ >
16+ > For example, the following code produces different output in 7.3 and 7.4:
17+ >
18+ > ``` cpp
19+ > JsonDocument doc;
20+ > doc[" a\0 b" ] = " c\0 d" ;
21+ > serializeJson (doc, Serial);
22+ > // With Arduino 7.3 -> {"a\u0000b":"c\u0000d"}
23+ > // With Arduino 7.4 -> {"a":"c"}
24+ > ```
25+ >
26+ > `JsonString` contructor now only accepts two arguments, not three.
27+ > If your code uses `JsonString` to store a string as a pointer, you must remove the size argument.
28+ >
29+ > For example, if you have something like this:
30+ >
31+ > ```cpp
32+ > doc["key"] = JsonString(str.c_str(), str.size(), true);
33+ > ```
34+ >
35+ > You must replace with either:
36+ >
37+ > ```cpp
38+ > doc["key"] = JsonString(str.c_str(), true); // store as pointer, cannot contain NUL characters
39+ > doc["key"] = JsonString(str.c_str(), str.size()); // store by copy, NUL characters allowed
40+ > doc["key"] = str; // same as previous line for supported string classes (`String`, `std::string`, etc.)
41+ > ```
942
1043v7.3.0 (2024-12-29)
1144------
You can’t perform that action at this time.
0 commit comments