Using the struct tag `json:"-"` on a struct field will cause it to be ignored when decoding JSON, even if the JSON input contains a corresponding key/value pair. The `omitzero` and `omitempty` struct tag directives do not have any effect on JSON decoding behavior.
Using the struct tag `json:"-"` on a struct field will cause it to be ignored when decoding JSON, even if the JSON input contains a corresponding key/value pair. The `omitzero` and `omitempty` struct tag directives do not have any effect on JSON decoding behavior.
| `json.SyntaxError` | There is a syntax problem with the JSON being decoded. |
| `io.ErrUnexpectedEOF` | There is a syntax problem with the JSON being decoded. |
| `json.UnmarshalTypeError` | A JSON value is not appropriate for the destination Go type. |
| `json.InvalidUnmarshalError` | The decode destination is not valid (usually because it is not a pointer). This is actually a problem with our application code, not the JSON itself. |
| `io.EOF` | The JSON being decoded is empty. |
Using the `errors.Is()` and `errors.As()` functions you can handle these errors and not expose internal details about your service. A common approach is to build a readJSON message that can be used to traige errors.
| Function | Purpose | Checks for | Example Use Case |