Not sure how to convert a FirebaseData object to a FirebaseJson object #430
-
I have defined a FirebaseData object like this:
Then I initialized it with data from a cloud firestore database like this:
Now I can't seem to convert the fbdo to a FirebaseJson object. I went through the documentation and examples and couldn't figure it out. I apologize if I am missing something obvious here. I've tried making a new FirebaseJsonData object like this:
and this:
but I get the same error: 'class FirebaseData' has no member named 'setJsonData' Also, I'd just like to mention that I really appreciate you taking the time to answer these questions in the discussions. Most people would not take the time to do this but the fact that you actually want to help users using your library is something I am beyond grateful for. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
https://github.com/mobizt/Firebase-ESP-Client/tree/main/examples/FirebaseJson |
Beta Was this translation helpful? Give feedback.
-
You must learn how to use Please try all Then you will get how to use FirebaseData is the object that involved the REST API data for request/response while FirebaseJson is the JSON serialize/deserialize library which is already included in the Firebase library. Before you use any library, you should go to library documentation to see what the functions library provided and how to use it properly. See the examples of that library provided for the usage guidelines. I don't want to describe the basic things because if you ever try the example enough, you will get the idea how to adapt it. For the Cloud Firestore functions description, please read this. For the For the For the For the JSON, please read here. |
Beta Was this translation helpful? Give feedback.
-
You can define the FirebaseJson with this constructor
or define the default constructor and assign the data to it later like this. FirebaseJson json;
json.setJsonData(fbdo.payload().c_str()); The deserializing (parsing) result will store in |
Beta Was this translation helpful? Give feedback.
-
If you are new to C++ and Arduino programming, the c_str() is the method or function of many string classes that return the const char* e.g. |
Beta Was this translation helpful? Give feedback.
https://github.com/mobizt/Firebase-ESP-Client/tree/main/examples/FirebaseJson