MCPcopy
hub / github.com/labstack/echo / Serialize

Method Serialize

dispatch_pool_test.go:56–64  ·  view source on GitHub ↗
(c *Context, i any, indent string)

Source from the content-addressed store, hash-verified

54type nestedJSONSerializer struct{}
55
56func (nestedJSONSerializer) Serialize(c *Context, i any, indent string) error {
57 if m, ok := i.(map[string]int); ok && m["outer"] == 1 {
58 // re-enter c.JSON once before encoding the outer payload
59 if err := c.JSON(http.StatusOK, map[string]int{"inner": 2}); err != nil {
60 return err
61 }
62 }
63 return (DefaultJSONSerializer{}).Serialize(c, i, indent)
64}
65
66func (nestedJSONSerializer) Deserialize(c *Context, i any) error {
67 return (DefaultJSONSerializer{}).Deserialize(c, i)

Callers

nothing calls this directly

Calls 2

JSONMethod · 0.80
SerializeMethod · 0.65

Tested by

no test coverage detected