3

Is there any possibility in Firebase to get data from node as JSON array, but not like multiple objects

For example I have:

https://additive-food-e2a9a.firebaseio.com/additive.json
{"-KjrTAOehl0RAvKYlYVp":{"alias":"Curcumin","danger":"2","name":"E100"},"-KjrUIm-itn8h8EjckNQ":{"alias":"Curcumin","danger":"2","name":"E100"},"-KjrXlvuJjMuogCJmGDK":{"alias":"Curcumin","danger":"2","name":"E100"}}

But I need something like:

[{"-KjrTAOehl0RAvKYlYVp":{"alias":"Curcumin","danger":"2","name":"E100"},"-KjrUIm-itn8h8EjckNQ":{"alias":"Curcumin","danger":"2","name":"E100"},"-KjrXlvuJjMuogCJmGDK":{"alias":"Curcumin","danger":"2","name":"E100"}] 
Sergey Zabelnikov
  • 1,855
  • 1
  • 14
  • 24
  • Is the only thing that is different about what you want that you put `[]` around it? If so, it should be easy to add the result you get from Firebase to an array. But this reads very much like a [XY problem](http://meta.stackexchange.com/questions/66377/what-is-the-xy-problem). Please describe the actual problem you're trying to solve, instead of the step of your solution where you got stuck. – Frank van Puffelen May 11 '17 at 13:32

1 Answers1

3

Firebase returns only JSON object when you hit GET request to the node. You have to apply JSON parsing logic in Java, Javascript or whatever language you use. Sample JSON Parsing logic in Java.

Community
  • 1
  • 1
Nagaraj N
  • 457
  • 6
  • 13