JSON binds the body string into the struct. Returns *BindError on parse failure (manual mode) or *Error with status 400 (auto-handling mode).
(out any)
| 300 | // JSON binds the body string into the struct. |
| 301 | // Returns *BindError on parse failure (manual mode) or *Error with status 400 (auto-handling mode). |
| 302 | func (b *Bind) JSON(out any) error { |
| 303 | bind := binder.GetFromThePool[*binder.JSONBinding](&binder.JSONBinderPool) |
| 304 | bind.JSONDecoder = b.ctx.App().Config().JSONDecoder |
| 305 | |
| 306 | defer releasePooledBinder(&binder.JSONBinderPool, bind) |
| 307 | |
| 308 | if err := b.returnBindErr(bind.Bind(b.ctx.Body(), out), BindSourceBody); err != nil { |
| 309 | return err |
| 310 | } |
| 311 | |
| 312 | return b.validateStruct(out) |
| 313 | } |
| 314 | |
| 315 | // CBOR binds the body string into the struct. |
| 316 | // Returns *BindError on parse failure (manual mode) or *Error with status 400 (auto-handling mode). |
no test coverage detected