MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / JSONValue

Function JSONValue

internal/htmlsanitize/htmlsanitize.go:62–81  ·  view source on GitHub ↗

JSONValue recursively escapes string values in JSON-compatible data.

(value any)

Source from the content-addressed store, hash-verified

60
61// JSONValue recursively escapes string values in JSON-compatible data.
62func JSONValue(value any) any {
63 switch typed := value.(type) {
64 case string:
65 return String(typed)
66 case []any:
67 out := make([]any, len(typed))
68 for index, item := range typed {
69 out[index] = JSONValue(item)
70 }
71 return out
72 case map[string]any:
73 out := make(map[string]any, len(typed))
74 for key, item := range typed {
75 out[key] = JSONValue(item)
76 }
77 return out
78 default:
79 return value
80 }
81}
82
83// IsJSONContentType reports whether contentType is application/json or a +json type.
84func IsJSONContentType(contentType string) bool {

Callers 1

JSONBodyFunction · 0.85

Calls 1

StringFunction · 0.85

Tested by

no test coverage detected