Skip to content

Commit 7dfa163

Browse files
committed
Update changelog
1 parent 905176e commit 7dfa163

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

CHANGELOG.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,39 @@ HEAD
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\0b"] = "c\0d";
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
1043
v7.3.0 (2024-12-29)
1144
------

0 commit comments

Comments
 (0)