formatMapToReadableString converts map to pretty JSON
(data map[string]interface{})
| 15 | |
| 16 | // formatMapToReadableString converts map to pretty JSON |
| 17 | func 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) |