MCPcopy
hub / github.com/gin-gonic/gin / JSON

Method JSON

errors.go:141–154  ·  errors.go::errorMsgs.JSON
()

Source from the content-addressed store, hash-verified

139}
140
141func (a errorMsgs) JSON() any {
142 switch length := len(a); length {
143 case 0:
144 return nil
145 case 1:
146 return a.Last().JSON()
147 default:
148 jsonData := make([]any, length)
149 for i, err := range a {
150 jsonData[i] = err.JSON()
151 }
152 return jsonData
153 }
154}
155
156// MarshalJSON implements the json.Marshaller interface.
157func (a errorMsgs) MarshalJSON() ([]byte, error) {

Callers 2

TestErrorSliceFunction · 0.95
MarshalJSONMethod · 0.95

Calls 2

LastMethod · 0.95
JSONMethod · 0.45

Tested by 1

TestErrorSliceFunction · 0.76