MarshalJSONString marshals a string to JSON format, returning the properly escaped JSON string. Returns empty string if there's an error (rare).
(s string)
| 205 | // MarshalJSONString marshals a string to JSON format, returning the properly escaped JSON string. |
| 206 | // Returns empty string if there's an error (rare). |
| 207 | func MarshalJSONString(s string) string { |
| 208 | jsonBytes, err := json.Marshal(s) |
| 209 | if err != nil { |
| 210 | return "" |
| 211 | } |
| 212 | return string(jsonBytes) |
| 213 | } |
| 214 | |
| 215 | // ContainsBinaryData checks if the provided data contains binary (non-text) content |
| 216 | func ContainsBinaryData(data []byte) bool { |
no outgoing calls
no test coverage detected