private function processJson($json)
    {
        $twee_array = json_decode($json, true);

        if (!isset($twee_array['data']) or empty($twee_array['data'])) {
            throw new RuntimeException("The provided JSON did not decode or is empty.");
        }

        foreach ($twee_array['data'] as $entity) {
            $type = $this->getTypeFromTags($entity['tags']);
            if (empty($type)) {
                $type = $this->getTypeFromTitle($entity['title']);
            }
            switch ($type) {
                case 'passage':
                    $passage = new TweePassage($entity);
                    $this->passages[$passage->title] = $passage;
                    // Set the start passage
                    if (in_array('start', $passage->tags)) {
                        $this->current_passage = $passage->title;
                        $this->history[] = $this->current_passage;
                        $this->storyline[] = $this->current_passage;
                    }
                    break;
                case 'title':
                    $this->title = $entity['text'];
                    break;
                case 'script':
                    $this->scripts[] = $entity['text'];
                    break;
                case 'stylesheet':
                    $this->stylesheets[] = $entity['text'];
                    break;
                default:
                    throw new \RuntimeException("Unknown entity type!");
            }
        }
        return true;
    }