MCPcopy
hub / github.com/wavetermdev/waveterm / MarshalJSONString

Function MarshalJSONString

pkg/util/utilfn/marshal.go:207–213  ·  view source on GitHub ↗

MarshalJSONString marshals a string to JSON format, returning the properly escaped JSON string. Returns empty string if there's an error (rare).

(s string)

Source from the content-addressed store, hash-verified

205// MarshalJSONString marshals a string to JSON format, returning the properly escaped JSON string.
206// Returns empty string if there's an error (rare).
207func 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
216func ContainsBinaryData(data []byte) bool {

Callers 2

makeTerminalBlockDescFunction · 0.92
validateTextFileFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected