null, "content" => null ]; if ($parts[1] === "metadata") { $data["members"][$parts[0]][$parts[1]] = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $file), true)); } else { $data["members"][$parts[0]][$parts[1]] = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $file), true); } } else { $data[$name] = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $file), true); } } else { if (strlen($parts[0]) === 5) { if (!isset($data["members"][$parts[0]])) $data["members"][$parts[0]] = [ "metadata" => null, "content" => null ]; $data["members"][$parts[0]][$parts[1]] = file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $file); } else { $data[$name] = file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $file); } } } } header("Content-Type: application/json"); die(json_encode($data, JSON_PRETTY_PRINT));