FormatJSON returns the input as JSON string.
(input *ResultData)
| 37 | |
| 38 | // FormatJSON returns the input as JSON string. |
| 39 | func FormatJSON(input *ResultData) ([]byte, error) { |
| 40 | var jsonOutput bytes.Buffer |
| 41 | |
| 42 | enc := json.NewEncoder(&jsonOutput) |
| 43 | enc.SetEscapeHTML(false) |
| 44 | |
| 45 | err := enc.Encode(input) |
| 46 | if err != nil { |
| 47 | return nil, err |
| 48 | } |
| 49 | |
| 50 | return jsonOutput.Bytes(), nil |
| 51 | } |
no outgoing calls