【公式ドキュメントを読もうシリーズ】無効な JSON のデバッグ
シリーズ概要
https://qiita.com/yasu_programming/items/cec66f9e8d5d571e9ce3
URL
https://docs.github.com/ja/copilot/copilot-chat-cookbook/debugging-errors/debugging-invalid-json
説明
JSONデータの構文エラーなどの具体的なプロンプトなどが書かれている。
これは確かに助かるものが多い。
Error: Parse error ----------------------^ Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '[', got 'undefined'
上記のようなエラーがあったときのJSONデータが下記である。
{ "location": "San Francisco", "current_weather": { "temperature": 18, "unit": "Celsius", "conditions": "Cloudy }, "forecast": { "day": "Monday", "high": 22, "low": 15, "precipitation": 10 } }
Why is my JSON object invalid and how can I fix it?
のプロンプトを入れると修正したJSONを出力してくれる。
Cloudyの箇所でダブルクオーテーションが抜けていることに関してのエラーだった。
所感
人間で確認するよりもAIに任せるほうが断然楽になる作業なので、助かる。