DevPath

Reject unknown JSON fields

Mid · practical lab · 20 min · runtime go

Brief

Decode a request body into a struct, reject unknown fields with a clear error, and bound the body size. Explain why each step matters.

3 progressive hints are available in the editor.

Public checks

  • disallows unknown fields — expected: calls DisallowUnknownFields