Closed PrateekGoyal18 closed 3 years ago
Library has the built-in JSON builder and parser class.
Declare the FirebaseJson object and use the method add to add new value or use set to replace or create new value.
FirebaseJson json;
//Hard code
json.add("/node1", 123.456f);
//or
json.set("/node2", 0.123f); //this also creates the node2 if it does not existed.
//From variable
json.add("/node3", myVal); // myVal is the float variable.
The supported variables are bool, int, float, and double. The supported object are String, FirebaseJson and FirebaseJsonArray. Unsupported variables are short, byte, uint8_t, uit16_t, uint32_t, long and so on.
Please check these examples to learn how to use the FirebaseJson object.
Getting this error:
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\sketch\final_code.ino.cpp.o:(.literal._Z4loopv+0x40): undefined reference to `FirebaseJson& FirebaseJson::add
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\sketch\final_code.ino.cpp.o: In function `loop()':
C:\Users\Prateek\OneDrive\Documents\Arduino\SCD30 Sensor Setup\OLED\final_code/final_code.ino:237: undefined reference to `FirebaseJson& FirebaseJson::add
collect2.exe: error: ld returned 1 exit status
You should update the library.
Recommend to update to v 3.8.0 (GitHub download is only available due to it updated 30 minutes ago)
Thanks, @mobizt. It's working flawlessly now.
I have some sensor data in float values. Is there some way by which I can add it to the JSON object?