no matching function for call to ‘makeString(const int&)’
(applies to ArduinoJson 6.6 and earlier)
You are in the right place if you get the following errors:
error: no matching function for call to 'makeString(const int&)'
...
error: invalid conversion from 'int' to 'const char*' [-fpermissive]
...
error: invalid conversion from 'int' to 'char*' [-fpermissive]
...
error: converting to 'String' from initializer list would use explicit constructor 'String::String(int, unsigned char)'
...
error: invalid conversion from 'int' to 'const __FlashStringHelper*' [-fpermissive]
(The compiler output is very long, I only extracted the lines with the actual error messages).
This error occurs when you index a JsonObject
with an integer instead of a string.
For example, it happens with the following code:
int i = 0;
auto value = obj[i];
Indeed, a JsonObject
can only be indexed by a string, like this:
const char* key = "key";
auto value = obj[key];
If you do need to access the members of the JsonObject
one by one, consider iterating over the key-value pairs:
for (JsonPair kv : obj) {
Serial.println(kv.key);
Serial.println(kv.value.as<const char*>());
}