diff --git a/Bag-of-Tricks.md b/Bag-of-Tricks.md index 3d18b63..4d53ff1 100644 --- a/Bag-of-Tricks.md +++ b/Bag-of-Tricks.md @@ -14,12 +14,7 @@ And we want to get a `int[]` out of it: #define MAX_LED_COUNT 10 int leds[MAX_LED_COUNT]; -int ledCount = 0; - -for(int led : root["leds"].asArray()) { - leds[ledCount++] = led; - if (ledCount >= MAX_LED_COUNT) break; -} +int ledCount = root["leds"].asArray().copyTo(leds); ``` See issue [#246](https://github.com/bblanchon/ArduinoJson/issues/246)