Home > OS >  Hierarchies In JSON
Hierarchies In JSON

Time:10-17

I'm trying to create a database in Firebase...

I'd like to change this 'zero' level in this database to 'StudentsList' but have no idea how to do it:

enter image description here

Could someone please show me the syntax to change that root level of the JSON please?

This is what I currently have:

[ { "Gender" : "Male", "NameOfStd" : "Karachi Boi", "RollNo" : "10", "Section" : "b" } ]

Thanks

CodePudding user response:

{"StudentsList" : { "Gender" : "Male", "NameOfStd" : "Karachi Boi", "RollNo" : "10", "Section" : "b" } }

"[]" indicate an array (so with integer index) whilst "{}" indicate a dictionary.

if you want a list of student the answer should probably be :

{"StudentsList" : [{ "Gender" : "Male", "NameOfStd" : "Karachi Boi", "RollNo" : "10", "Section" : "b" }] }

which will give you this :

enter image description here

  • Related