From 238d37a132c4783b87735c57535bdd7f2ee597a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Blanchon?= Date: Mon, 10 Oct 2016 16:14:49 +0200 Subject: [PATCH] Updated FAQ (markdown) --- FAQ.md | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/FAQ.md b/FAQ.md index be25a1f..9e611c3 100644 --- a/FAQ.md +++ b/FAQ.md @@ -172,21 +172,15 @@ See [ArduinoJson: Avoiding pitfalls](https://github.com/bblanchon/ArduinoJson/wi ### Why shouldn't I use a global `JsonBuffer`? -ArduinoJson is designed to do one thing and to do it well: **the JSON serialization**. -It's not a framework that you can use as a backbone of your application. -In particular `JsonObject` and `JsonArray` should not replace your own data structures; that would be terribly inefficient. - -So before trying to use a global `JsonBuffer`, ask yourself first "Am I really using ArduinoJson for serializing, or am I pushing it beyond its initial intent?". - -See also [How to reuse a `JsonBuffer`?](#how-to-reuse-a-jsonbuffer) and [What's the best way to use the library?](#whats-the-best-way-to-use-the-library). - -See issues [#160](https://github.com/bblanchon/ArduinoJson/issues/160), [#203](https://github.com/bblanchon/ArduinoJson/issues/203), [#219](https://github.com/bblanchon/ArduinoJson/issues/219), [#242](https://github.com/bblanchon/ArduinoJson/issues/242), [#243](https://github.com/bblanchon/ArduinoJson/issues/243), [#341](https://github.com/bblanchon/ArduinoJson/issues/341) and [#347](https://github.com/bblanchon/ArduinoJson/issues/347). - ### How to reuse a `JsonBuffer`? `StaticJsonBuffer` and `DynamicJsonBuffer` are designed to be throwaway memory pools, they are not intended to be reused. As a consequence, using a global `JsonBuffer` is almost always a bad idea. +ArduinoJson is designed to do one thing and to do it well: **the JSON serialization**. +In particular `JsonObject` and `JsonArray` should not replace your own data structures; that would be terribly inefficient. +So before trying to use a global `JsonBuffer`, ask yourself first "Am I really using ArduinoJson for serializing, or am I pushing it beyond its initial intent?". + If you believe you need to reuse a `JsonBuffer`, it's because [you're not using the library correctly](https://github.com/bblanchon/ArduinoJson/wiki/FAQ#whats-the-best-way-to-use-the-library). ##### 1. There is a reason behind this. @@ -211,14 +205,13 @@ Destructing an constructing a new `StaticJsonBuffer` is not expensive, it's exac ##### 3. A workaround -You can find a very simple workaround in the [Bag of tricks](https://github.com/bblanchon/ArduinoJson/wiki/Bag-of-Tricks#reuse-jsonbuffer). +If you understand fully the consequences, you can find a very simple workaround in the [Bag of tricks](https://github.com/bblanchon/ArduinoJson/wiki/Bag-of-Tricks#reuse-jsonbuffer). -This will never be a part of the library. - -See issues [#72](https://github.com/bblanchon/ArduinoJson/issues/72), [#115](https://github.com/bblanchon/ArduinoJson/issues/115), [#141](https://github.com/bblanchon/ArduinoJson/issues/141) and [#242](https://github.com/bblanchon/ArduinoJson/issues/242) - -See [ArduinoJson: Avoiding pitfalls](https://github.com/bblanchon/ArduinoJson/wiki/Avoiding-pitfalls#4-dont-reuse-the-same-jsonbuffer) +See also: +* [Avoiding pitfalls: Don't reuse the same JsonBuffer](https://github.com/bblanchon/ArduinoJson/wiki/Avoiding-pitfalls#4-dont-reuse-the-same-jsonbuffer) +* [What's the best way to use the library?](#whats-the-best-way-to-use-the-library) +* issues [#72](https://github.com/bblanchon/ArduinoJson/issues/72), [#115](https://github.com/bblanchon/ArduinoJson/issues/115), [#141](https://github.com/bblanchon/ArduinoJson/issues/141), [#160](https://github.com/bblanchon/ArduinoJson/issues/160), [#203](https://github.com/bblanchon/ArduinoJson/issues/203), [#219](https://github.com/bblanchon/ArduinoJson/issues/219), [#242](https://github.com/bblanchon/ArduinoJson/issues/242), [#243](https://github.com/bblanchon/ArduinoJson/issues/243), [#341](https://github.com/bblanchon/ArduinoJson/issues/341) and [#347](https://github.com/bblanchon/ArduinoJson/issues/347). ### What's the best way to use the library?