MCPcopy Create free account
hub / github.com/EBWi11/AgentSmith-HUB / formatMapToReadableString

Function formatMapToReadableString

config/plugin/pushMsgToLark.go:17–27  ·  view source on GitHub ↗

formatMapToReadableString converts map to pretty JSON

(data map[string]interface{})

Source from the content-addressed store, hash-verified

15
16// formatMapToReadableString converts map to pretty JSON
17func formatMapToReadableString(data map[string]interface{}) string {
18 if data == nil {
19 return "{}"
20 }
21 b, err := json.MarshalIndent(data, "", " ")
22 if err != nil {
23 flat, _ := json.Marshal(data)
24 return string(flat)
25 }
26 return string(b)
27}
28
29// Eval pushes message to Lark/Feishu via webhook.
30// Param1: WebhookURL (the url without timestamp&sign)

Callers 1

EvalFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected