title: Convert FirebaseDatabase jsonObject to jsonArray and then that jsonArray to .xlsx format
body: <p>I'm getting DataSnapshot from a Firebase database as a <code>JsonObject</code>. I have to convert this <code>JsonObjec</code>t into JsonArray and then that JsonArray into Excel format and then download that file into mobile storage. How can I do this?</p>
  
  <p>Here I am getting the <code>DataSnapshot</code> on button click:</p>
  
  <pre class="lang-java prettyprint-override"><code> btnJson.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              databaseReference.addListenerForSingleValueEvent(new ValueEventListener() {
                  @Override
                  public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
                      long a = dataSnapshot.getChildrenCount();
                      System.out.println("lc" + a);
                      for (DataSnapshot ds : dataSnapshot.getChildren()) {
                          System.out.println("response1" + ds);
                      }
                  }
                  @Override
                  public void onCancelled(@NonNull DatabaseError databaseError) {
                  }
              });
          }
      });
  </code></pre>
  
  <p>Here is the response I am getting on button click in jsonObject:</p>
  
  <blockquote>
    <p>{ key = 13uhnjvczw, value = {survey_title=Sports,
    questions={4={type=2, title=Who is the top goal scorer in La Liga?},
    0={options={0=13, 1=5}, type=1, title=How many ucl has real madrid
    won},   1={options={0=Real Madrid fc, 1=Liverpool fc}, type=1,
    title=Who is the current UCL champion?},   3={type=2, title=Who is the
    top goal scorer in UCL?},  2={options={0=Cristiano Ronaldo, 1=Zinedine
    Zidane}, type=1, title=Who is the all time top scorer of Real
    Madrid?}}} }</p>
  </blockquote>