Comments (5)
Hi @MHz000,
When you get an error when compiling a C++ program, you must look at the first error in the compiler output (which might not be the order shown in the IDE).
In your case, the first error is:
error: no matching function for call to 'ArduinoJson::V703PB2::JsonDocument::JsonDocument(int)'
This error tells that JsonDocument
has no constructor with an int
parameter.
You can fix it like so:
- JsonDocument doc(1536);
+ JsonDocument doc;
If you think a document was unclear and led you to make this error, please let me know so I can fix it immediately.
Best regards,
Benoit
from arduinojson.
BINGO!
Hi Benoit, your tip solved my problem straight away, thank you!;
You will have seen at first glance that I am not an experienced C++ programmer. So I dare to ask you another question. In my program I receive an extensive JSON file see appendix, which I use to decode by
if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY) {
String payload = https.getString();
Serial.println("GOT API RESPONSE");
decodeJsonPayload(payload.c_str());
take apart
void decodeJsonPayload(const char* payload) {
JsonDocument doc;
DeserializationError error = deserializeJson(doc, payload);
if (error) { ...
</code)
My problem: I only get the last part of the deserialization_ed payload as a result.
If it helps with the solution I would be happy to send the entire source code#
Thank you
Joschen
JSON-data.txt
from arduinojson.
What does the ArduinoJson Troubleshooter say?
from arduinojson.
Hi Beniot
thanks to your hint
"You can fix it like this:
- JsonDocument doc(1536);
- JsonDocument doc;"
I can now use the JSON document without any problems. You can find a JSON example in the appendix. My question boils down to this: How can I access the individual sub-documents {timestamp...}, {timestamp...},... separately? Yes, it is possible to use String operators to do this. This is tedious, error-prone and boring. Is there a more elegant way.
Thank you for your great library and support
Joschen
JSON-data.txt
from arduinojson.
Hi Joschen,
You can find extensive documentation at https://arduinojson.org/
Let me know if you have any issues.
Best regards,
Benoit
from arduinojson.
Related Issues (20)
- Filtering large arrays of objects HOT 4
- deserializeJson from HTTP result in EmptyInput error HOT 3
- best way to create a sub document HOT 6
- Callback-based filter HOT 1
- Adding entry in JsonObject using File object causes corrupted JSON HOT 1
- Initial serializing HOT 7
- `doc[var]` doesn't work when `var` contains a string
- JsonArray.add(JsonObject) adds partial JsonObject when the JsonDocument is full HOT 6
- ArduinoJson.h: No such file or directory HOT 3
- JsonVariant tests false for both a value that doesn't exist and for a value that is zero HOT 7
- How do i create JSON array of objects using ArduinoJson library. HOT 1
- Identifying JsonVariant type of a deserialized document HOT 4
- Example code results in compiler error: no match for 'operator+=' HOT 3
- Passing JsonDocument by reference HOT 4
- In Memory Deserialization HOT 4
- v7 equivalent of validateJson HOT 2
- conversion from ‘ArduinoJson::V704HB42::detail::enable_if<true, ArduinoJson::V704HB42::JsonVariantConst>::type’ {aka ‘ArduinoJson::V704HB42::JsonVariantConst’} to ‘ArduinoJson::V704HB42::JsonDocument’ is ambiguous HOT 1
- Assertion `poolIndex < count_' failed HOT 1
- Maximum string length of 13 characters HOT 2
- V6 Documentation ArduinoJson PubSubClient with StreamUtils HOT 1
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.