MCPcopy
hub / github.com/andeya/pholcus / JSONString

Function JSONString

common/util/util.go:286–292  ·  view source on GitHub ↗

JSONString converts obj to a JSON string.

(obj interface{})

Source from the content-addressed store, hash-verified

284
285// JSONString converts obj to a JSON string.
286func JSONString(obj interface{}) string {
287 b, _ := json.Marshal(obj)
288 s := fmt.Sprintf("%+v", Bytes2String(b))
289 r := strings.ReplaceAll(s, `\u003c`, "<")
290 r = strings.ReplaceAll(r, `\u003e`, ">")
291 return r
292}
293
294// CheckErr checks and logs the error if non-nil.
295func CheckErr(err error) {

Callers 7

initFunction · 0.92
initFunction · 0.92
initFunction · 0.92
initFunction · 0.92
initFunction · 0.92
PushMethod · 0.92
TestJSONStringFunction · 0.85

Calls 2

Bytes2StringFunction · 0.85
MarshalMethod · 0.65

Tested by 1

TestJSONStringFunction · 0.68