Closed mixaobo closed 5 years ago
Function setJSON requires json serialized string.
Please remember that JSON is only key-value paired notation which can be handle or manage differently depends on system and parser.
The ArduinoJson handle and manage it by its own class (object), form create, parse, to serialize, and it has its own functions that return to string directly as stansard c++ string or C chars array for you to use.
ArduinoJson v5 provides printTo function to return string from its JSON object.
String myString;
object.printTo(myString);
//Now use myString in setJSON function
Firebase.setJSON(firebaseData, path1, myString);
Function setJSON require json serialized string.
Please remember that JSON is only key-value paired notation which can be handle or manage differently depends on system and parser.
The ArduinoJson handle and manage it by its own class (object), form create, parse, to serialize, and it has its own functions that return to string directly as stansard c++ string or C chars array for you to use.
ArduinoJson v5 provide printTo function to return string from its JSON object.
String myString; object.printTo(myString); //Now use myString in setJSON function Firebase.setJSON(firebaseData, path1, myString);
https://arduinojson.org/v5/api/jsonobject/printto/
Function setJSON requires json serialized string.
Please remember that JSON is only key-value paired notation which can be handle or manage differently depends on system and parser.
The ArduinoJson handle and manage it by its own class (object), form create, parse, to serialize, and it has its own functions that return to string directly as stansard c++ string or C chars array for you to use.
ArduinoJson v5 provides printTo function to return string from its JSON object.
String myString; object.printTo(myString); //Now use myString in setJSON function Firebase.setJSON(firebaseData, path1, myString);
sorry for noob question, since i use arduinojson v6. are there anyway to use printTo. they just use serializeJson
Read this for how to print as string. https://arduinojson.org/v6/example/string/
For print to string variable, do the same way as you print to Serial.
serializeJson(object, myString);
here is my code, i can set each value but need totaly 4 times, i know there is a setJSON but i cant get it work. here is my code
which i get from serial monitor:
{"1":{"Temperature":29.8,"Humidity":41,"Soil":2,"Battery":3292.593}}
error is no match function code setJSON My code and error