0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【公ド読】無効な JSON のデバッグ

Last updated at Posted at 2025-05-17

【公式ドキュメントを読もうシリーズ】無効な 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に任せるほうが断然楽になる作業なので、助かる。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?