mobizt / Firebase-ESP32

[DEPRECATED]🔥 Firebase RTDB Arduino Library for ESP32. The complete, fast, secured and reliable Firebase Arduino client library that supports CRUD (create, read, update, delete) and Stream operations.
MIT License
415 stars 118 forks source link

how to read a Jason? #78

Closed biswajitjei02 closed 4 years ago

biswajitjei02 commented 4 years ago

image

here want a Jason like this {newvalue: 32, value: 1,value1: "no"}

mobizt commented 4 years ago

If you want to get the data at the root of your database, use Firebase.getJSON with the path parameter "/"

  Firebase.getJSON(firebaseData, "/");

  FirebaseJson &json = firebaseData.jsonObject();

  FirebaseJsonData parseRsult;

  json.get(parseRsult, "/newvalue");

  if (parseRsult.success)
  {
    Serial.println(parseRsult.intValue);
  }

  json.get(parseRsult, "/value");

  if (parseRsult.success)
  {
    Serial.println(parseRsult.intValue);
  }

  json.get(parseRsult, "/value1");

  if (parseRsult.success)
  {
    Serial.println(parseRsult.stringValue);
  }

For more usage of the FirebaseJson object

https://github.com/mobizt/Firebase-ESP32#parse-create-and-edit-json-objects https://github.com/mobizt/Firebase-ESP32/blob/master/examples/jsonObject/jsonObject.ino https://github.com/mobizt/Firebase-ESP32/tree/master/examples/FirebaseJson/examples

biswajitjei02 commented 4 years ago

i want to store as a single Json a ,how it can be done ?

mobizt commented 4 years ago

I don't understand what you mean.

mobizt commented 4 years ago

Please read the Readme doc or start with the examples.