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

Function formatMapToReadableString

config/plugin/pushMsgToDingDing.go:22–39  ·  view source on GitHub ↗

formatMapToReadableString converts map[string]interface{} to a formatted JSON string

(data map[string]interface{})

Source from the content-addressed store, hash-verified

20
21// formatMapToReadableString converts map[string]interface{} to a formatted JSON string
22func formatMapToReadableString(data map[string]interface{}) string {
23 if data == nil {
24 return "{}"
25 }
26
27 // Convert to formatted JSON with indentation
28 jsonBytes, err := json.MarshalIndent(data, "", " ")
29 if err != nil {
30 // Fallback to regular JSON if indent fails
31 fallbackBytes, fallbackErr := json.Marshal(data)
32 if fallbackErr != nil {
33 return "{}"
34 }
35 return string(fallbackBytes)
36 }
37
38 return string(jsonBytes)
39}
40
41// Eval sends formatted message data to DingTalk
42func Eval(AccessToken string, Secret string, data map[string]interface{}) (bool, error) {

Callers 1

EvalFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected