Updated Bag of Tricks (markdown)

Benoît Blanchon
2016-03-22 10:59:39 +01:00
parent 1628f25f87
commit d41eee47fe

@@ -1,5 +1,29 @@
Here are helper class that can help you add missing features. Here are helper class that can help you add missing features.
## Extract an array of integer
Suppose we have an input like this:
```json
{"leds":[56,60,46]}
```
And we want to get a `int[]` out of it:
```c++
#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;
}
```
See issue [#246](https://github.com/bblanchon/ArduinoJson/issues/246)
## Buffered output: ## Buffered output:
Here is a proxy that will put bytes in a buffer before actually writing them to the destination: Here is a proxy that will put bytes in a buffer before actually writing them to the destination: