MarshalJSON marshals x into json It differs a bit from encoding/json MarshalJSON function for formatter
(x any)
| 14 | // MarshalJSON marshals x into json |
| 15 | // It differs a bit from encoding/json MarshalJSON function for formatter |
| 16 | func MarshalJSON(x any) ([]byte, error) { |
| 17 | m, err := marshalMap(x) |
| 18 | if err != nil { |
| 19 | return nil, err |
| 20 | } |
| 21 | return json.Marshal(m) |
| 22 | } |
| 23 | |
| 24 | // marshalMap marshals x to map[string]any |
| 25 | func marshalMap(x any) (map[string]any, error) { |
no test coverage detected
searching dependent graphs…