ToJSON return a string with the JSON representation of the interface{}
(i any, prefix string, indentation string)
| 30 | |
| 31 | // ToJSON return a string with the JSON representation of the interface{} |
| 32 | func ToJSON(i any, prefix string, indentation string) (string, error) { |
| 33 | buffer := &bytes.Buffer{} |
| 34 | encoder := json.NewEncoder(buffer) |
| 35 | encoder.SetEscapeHTML(false) |
| 36 | encoder.SetIndent(prefix, indentation) |
| 37 | err := encoder.Encode(i) |
| 38 | return buffer.String(), err |
| 39 | } |
no test coverage detected