Deserialize reads a JSON from a request body and converts it into an interface.
(c *Context, target any)
| 22 | |
| 23 | // Deserialize reads a JSON from a request body and converts it into an interface. |
| 24 | func (d DefaultJSONSerializer) Deserialize(c *Context, target any) error { |
| 25 | if err := json.NewDecoder(c.Request().Body).Decode(target); err != nil { |
| 26 | return ErrBadRequest.Wrap(err) |
| 27 | } |
| 28 | return nil |
| 29 | } |