Closed
Description
Description
I am in the process of migrating existing code to ArduinoJson v7, and I have had issues with compilation that I believe stem from changes to the library. In previous versions of the library, I was able to add a char
to a StaticJsonDocument
without issue. In v7 adding a char
to a JsonDocument
produces an error with the convertToJson
function.
My intended target is Teensy 3.2, but I have been able to reproduce this issue with the provided code on other platforms such as Arduino Uno.
My provided reproduction code works with version 6.19.4, but not with 6.20.0 or thereafter.
Troubleshooter's report
- The program uses ArduinoJson 7
- The issue happens at compile time
- Error says "no matching function for call to ..."
- Error says "no matching function for call to
convertToJson(...)
" - Converting the value doesn't fix the issue
Environment
- Microcontroller: Teensy 3.2
- Core/Framework: Teensyduino
- IDE: Arduino IDE 2.2.1
Reproduction code
#include <ArduinoJson.h>
void setup() {
JsonDocument doc;
//This will compile:
//const char* cs = "A";
//doc["val"] = cs;
//This will not compile with ArduinoJson version 6.20.0 or greater - error: no matching function for call to 'convertToJson(const char&, ArduinoJson::V702L1::JsonVariant&)'
char c = 'A';
doc["val"] = c;
}
void loop() {
// put your main code here, to run repeatedly:
}