public function decode($json)
    {
        // Clear the path array.
        $this->paths = array();
        // Decode the given JSON data if necessary.
        $x = is_string($json) ? json_decode($json) : $json;
        // Get all data paths.
        $this->getPaths($x);
        // Resolve all path references.
        $this->resolvePathReferences($x);
        // Return the data.
        return $x;
    }