CS111: Data Types - Objects (JSON)
Using object literals and JSON for configuration
Data Types: Objects (JSON)
Objective
Students must use object literals and JSON notation to structure and store complex data.
Evidence
Object and JSON usage in game components:
- GameLevelOutside.js - Configuration objects with game settings
- GameLevelMaze.js - Maze layout objects
- Multiple classes - Game entity data structures
Implementation Details
- Object literal notation with key-value pairs
- Accessing properties with dot notation and bracket notation
- JSON format for data representation
- Nested objects for hierarchical data
- Object methods and properties
Key Concepts
- Object literals:
{ key: value } - Property access: dot notation vs bracket notation
- JSON format and JSON methods (parse, stringify)
- Object methods: Object.keys, Object.values, Object.entries
- Destructuring for extracting properties