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"}] 
1
  • 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. Please describe the actual problem you're trying to solve, instead of the step of your solution where you got stuck. Commented May 11, 2017 at 13:32

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.