Skip to content

How to Store Array to Firebase #222

Locked Answered by mobizt
giservin asked this question in Q&A
Jul 5, 2021 · 3 comments · 10 replies
Discussion options

You must be logged in to vote

Here the basic usage example of array.

FirebaseData fbdo;
FirebaseJsonArray arr; // you can add or set the array data

arr.add(123); //index 0
arr.add(true);
arr.add("test");
arr.add(456.789); //index 3
//arr.set("/[5]", "hello"); //index 5 assigned with path, now index 4 which never assigned will be null value.
//arr.set(7, 999); //index 7 assigned with number, now index 6 will be null value.
//arr.set("/[8]/car/[2]/xyz", true); //index 8 assigned with nested array and json object inside.

if (Firebase.setArray(fbdo, "path/to/node", arr)) //or Firebase.set(fbdo, "path/to/node", arr)
{
  Seril.println("set array ok");
}else{
  Seril.println("set array failed");
  Seril.println(fbdo.errorR…

Replies: 3 comments 10 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by giservin
Comment options

You must be logged in to vote
6 replies
@mobizt
Comment options

@afrzlhmd
Comment options

@mobizt
Comment options

@mobizt
Comment options

@afrzlhmd
Comment options

Comment options

You must be logged in to vote
4 replies
@giservin
Comment options

@sajjadatgithub
Comment options

@sajjadatgithub
Comment options

@mobizt
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants