Ask your AI Ask your AI to turn this code into a guided bug-finding exercise.
Claude ChatGPT I am reading "An HTTP API must reject misspelled JSON fields instead of silently ignoring them. Which decoder setup enforces that contract?" on CodeWiki (https://codewiki.com/practice/mcq/go/checkpoint-4/checkpoint-4-json-boundary/).
Context (verbatim from the page):
"""
An HTTP API must reject misspelled JSON fields instead of silently ignoring them. Which decoder setup enforces that contract?
Create a `json.Decoder`, call `DisallowUnknownFields`, then decode.
Use `json.Unmarshal`; it rejects unknown fields by default.
Add `omitempty` to every response field.
"""
Introduce three subtle bugs into the example above and let me find them. Reveal each answer only after I have guessed.
Answer in English. Keep code examples in Go. Where you are unsure, say so.