Comments (5)
That is a very curious feature request 😲
I think that the idea of a DynamicJsonObject
that you create by merging JsonObject
s is not handy.
In the other hand, I can try to draft a DynamicJsonObject
that would automatically grow as you add data.
That would give you:
DynamicJsonObject dynamicObject;
dynamicObject["key1"] = 1;
dynamicObject["key2"] = 2;
dynamicObject["key3"] = 3;
It would implicitly call malloc()
, realloc()
and free()
, breaking the idea of a "malloc-free" library; but in the other hand, it could be useful for some specific usages.
What do you think?
from arduinojson.
Static allocation has more advantages in embedded systems but sometimes dynamic allocation can be necessary. Think about a configuration service object that keeps the config keys of the modules in the system and saves them into eeprom. In this example, configuration service object can not know the count of the keys. Modules define their config-sets as JsonObject and configuration service object merges them into DynamicJsonObject.
I think, both static & dynamic allocated Json library will be perfect. If you decide to implement this, we can talk more about the api and usage scenarios before coding.
from arduinojson.
I agree this would be a very useful addition for embedded systems that do use dynamic memory.
from arduinojson.
I like the idea of a library that provide both static and dynamic allocation.
I also like the idea of adding the word Dynamic
to the names because the user is aware that he may be doing something dangerous.
I'll try to free some time on the week-end to write a draft version.
I'll keep you informed with the progress.
from arduinojson.
Done!
In version 4.1, you can use DynamicJsonBuffer
in place of StaticJsonBuffer<N>
to switch to a dynamic memory allocation.
from arduinojson.
Related Issues (20)
- [Fresh migration from V6] CollectionIterator crash HOT 7
- Error with timestamp HOT 3
- Getting EmptyInput from deserializeJson when using external json file opened with LittleFS HOT 4
- Does not compile on any ESP8266
- ArduinoJson 7 uses ~30 kb more stack on Teensy 4.1 HOT 4
- Need some help extracting from a payload
- `volatile bool` serialized as `1` or `0` instead of `true` or `false` HOT 4
- Losing const char* data while using doc["fileName"].set(cFileName); HOT 5
- Compiler Fehler HOT 1
- Broken link in a given error. HOT 1
- `CappedAllocator` for ArduinoJson 7 HOT 4
- Switching from ArduinoJson 6 to 7 leads to a random assertion failure at runtime: `const VariantPoolList.hpp:98 (poolIndex < count_` HOT 10
- Broken link in compiler error message HOT 1
- Comparison operators for custom types HOT 5
- Precise the meaning of `doc.overflowed()` with the default allocator with ArduinoJson 7 HOT 4
- How to get the size of the document in v7? HOT 2
- Compilation fail on pure example JsonParserExample.ino and Arduino IDE 2.2.1 HOT 2
- conflicting Zero-copy mode documentation HOT 4
- Can arduinojson work with ESP spi.transfer() ? HOT 3
- Adding a char as a member of a JsonDocument produces a convertToJson error HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arduinojson.