MCPcopy Create free account
hub / github.com/QuantumNous/new-api / parseJSONArray

Function parseJSONArray

setting/console_setting/validation.go:26–32  ·  view source on GitHub ↗
(jsonStr string, formatErrorKey string)

Source from the content-addressed store, hash-verified

24)
25
26func parseJSONArray(jsonStr string, formatErrorKey string) ([]map[string]any, error) {
27 var list []map[string]any
28 if err := common.UnmarshalJsonStr(jsonStr, &list); err != nil {
29 return nil, common.NewMessage(formatErrorKey, map[string]any{"error": err.Error()})
30 }
31 return list, nil
32}
33
34func exceedsMaxCharacters(s string, max int) bool {
35 return len(utf16.Encode([]rune(s))) > max

Callers 4

validateApiInfoFunction · 0.85
validateAnnouncementsFunction · 0.85
validateFAQFunction · 0.85
validateUptimeKumaGroupsFunction · 0.85

Calls 3

UnmarshalJsonStrFunction · 0.92
NewMessageFunction · 0.92
ErrorMethod · 0.45

Tested by

no test coverage detected