Search⌘ K
AI Features

JSON-structure of a real-world application

Explore how to represent a real-world application's state using Ruby hashes that model JSON structures. Understand organizing data with nested arrays and hashes to manage UI state for tasks such as filtering and adding to-do items.

We'll cover the following...

JSON hash

The JSON structure is a universal way to describe almost any data. For example, the following hash represents the state of a user interface (UI) of a minimalist to-do list application:

{
  todos: [{
    text: 'Eat donut',
    completed: true
  }, {
    text: 'Go to gym',
    completed: false
  }],
  visibility_fiter: :show_completed
}

The UI part of the ...