MCPcopy Create free account
hub / github.com/HashLoad/boss / JSONMarshal

Function JSONMarshal

utils/parser/parser.go:8–17  ·  view source on GitHub ↗
(v interface{}, safeEncoding bool)

Source from the content-addressed store, hash-verified

6)
7
8func JSONMarshal(v interface{}, safeEncoding bool) ([]byte, error) {
9 b, err := json.MarshalIndent(v, "", "\t")
10
11 if safeEncoding {
12 b = bytes.ReplaceAll(b, []byte("\\u003c"), []byte("<"))
13 b = bytes.ReplaceAll(b, []byte("\\u003e"), []byte(">"))
14 b = bytes.ReplaceAll(b, []byte("\\u0026"), []byte("&"))
15 }
16 return b, err
17}

Callers 1

SaveMethod · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected