0
0
Firebasecloud~10 mins

JSON tree structure in Firebase - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a root node in a Firebase JSON tree.

Firebase
{
  "root": [1]
}
Drag options to blanks, or click blank then click option'
A"rootValue"
B"data"
C"value"
D"node"
Attempts:
3 left
💡 Hint
Common Mistakes
Using an empty string as the root value
Using invalid JSON syntax like missing quotes
2fill in blank
medium

Complete the code to add a child node named 'users' under the root.

Firebase
{
  "root": {
    [1]: {}
  }
}
Drag options to blanks, or click blank then click option'
A"accounts"
B"users"
C"clients"
D"members"
Attempts:
3 left
💡 Hint
Common Mistakes
Using a different child node name
Missing quotes around the key
3fill in blank
hard

Fix the error in the JSON tree by completing the missing key for a user ID.

Firebase
{
  "root": {
    "users": {
      [1]: {
        "name": "Alice"
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
A"name"
Buser1
C"user1"
D"id"
Attempts:
3 left
💡 Hint
Common Mistakes
Using unquoted keys which is invalid JSON
Using wrong key names like 'name' or 'id' instead of user ID
4fill in blank
hard

Fill both blanks to add two users with their names under 'users'.

Firebase
{
  "root": {
    "users": {
      [1]: {"name": "Bob"},
      [2]: {"name": "Carol"}
    }
  }
}
Drag options to blanks, or click blank then click option'
A"user1"
B"user2"
C"user3"
D"user4"
Attempts:
3 left
💡 Hint
Common Mistakes
Using duplicate keys
Using keys without quotes
5fill in blank
hard

Fill all three blanks to add a nested address object for user1.

Firebase
{
  "root": {
    "users": {
      "user1": {
        "name": "Dave",
        "address": {
          "street": [1],
          "city": [2],
          "zip": [3]
        }
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
A"123 Main St"
B"Springfield"
C"12345"
D"Unknown"
Attempts:
3 left
💡 Hint
Common Mistakes
Missing quotes around string values
Using numeric values without quotes for zip