{"meta":{"title":"잘못된 JSON 디버깅","intro":"공동 파일럿 채팅은 JSON 데이터의 구문 오류나 구조적 문제를 식별하고 해결할 수 있습니다.","product":"GitHub Copilot","breadcrumbs":[{"href":"/ko/copilot","title":"GitHub Copilot"},{"href":"/ko/copilot/tutorials","title":"자습서"},{"href":"/ko/copilot/tutorials/copilot-chat-cookbook","title":"GitHub Copilot Chat 매뉴얼"},{"href":"/ko/copilot/tutorials/copilot-chat-cookbook/debug-errors","title":"오류 디버깅"},{"href":"/ko/copilot/tutorials/copilot-chat-cookbook/debug-errors/debug-invalid-json","title":"잘못된 JSON 디버그"}],"documentType":"article"},"body":"# 잘못된 JSON 디버깅\n\n공동 파일럿 채팅은 JSON 데이터의 구문 오류나 구조적 문제를 식별하고 해결할 수 있습니다.\n\nJSON 데이터를 사용하는 경우 후행 쉼표, 일치하지 않는 중괄호, JSON을 유효하지 않은 잘못된 데이터 형식과 같은 문제가 발생할 수 있습니다. 깃허브 코파일럿 채팅은 잘못된 JSON을 수정하도록 수정을 제안하여 이러한 오류를 디버그하고 수정하는 데 도움이 될 수 있습니다.\n\n## 예제 시나리오\n\n애플리케이션이 API에서 JSON 데이터를 사용하지만, 잘못된 서식 지정으로 인해 응답이 구문 분석되지 않는 시나리오를 고려해 보세요. 오류 메시지가 표시됩니다.\n\n```bash\nError: Parse error\n----------------------^\nExpecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '[', got 'undefined'\n```\n\n다음은 오류를 발생시킨 JSON 데이터입니다.\n\n```json id=json-error\n{\n  \"location\": \"San Francisco\",\n  \"current_weather\": {\n    \"temperature\": 18,\n    \"unit\": \"Celsius\",\n    \"conditions\": \"Cloudy\n  },\n  \"forecast\": {\n    \"day\": \"Monday\",\n    \"high\": 22,\n    \"low\": 15,\n    \"precipitation\": 10\n  }\n}\n```\n\n## 예시 프롬프트\n\n```copilot copy prompt ref=json-error\nWhy is my JSON object invalid and how can I fix it?\n```\n\n## 예제 응답\n\n> \\[!NOTE] 다음 응답이 예제입니다. 공동 파일럿 채팅 응답은 비결정적이므로 여기에 표시된 응답과 다른 응답을 얻을 수 있습니다.\n\n> \\[!NOTE] 다음 응답이 예제입니다. 공동 파일럿 채팅 응답은 비결정적이므로 여기에 표시된 응답과 다른 응답을 얻을 수 있습니다.\n> Copilot은 `conditions` 값에 대한 닫는 따옴표가 없으므로 JSON이 유효하지 않다고 제안할 수 있습니다.\n\n```json\n{\n  \"location\": \"San Francisco\",\n  \"current_weather\": {\n    \"temperature\": 18,\n    \"unit\": \"Celsius\",\n    \"conditions\": \"Cloudy\"\n  },\n  \"forecast\": {\n    \"day\": \"Monday\",\n    \"high\": 22,\n    \"low\": 15,\n    \"precipitation\": 10\n  }\n}\n```\n\n수정된 JSON은 다음과 같습니다.\n\n## 이 예제 응답에서 Copilot의 제안에는 JSON 구문 분석 오류를 해결하는 `conditions` 값의 닫는 따옴표 수정이 포함됩니다.\n\n* [GitHub Copilot 채팅에 대한 프롬프트 엔지니어링](/ko/copilot/using-github-copilot/prompt-engineering-for-github-copilot)\n* [GitHub 부필로트 사용에 대한 모범 사례](/ko/copilot/using-github-copilot/best-practices-for-using-github-copilot)"}