MCPcopy Create free account
hub / github.com/compozy/agh / parseRequiredJSONRawMessage

Function parseRequiredJSONRawMessage

internal/cli/json_flags.go:11–21  ·  view source on GitHub ↗
(raw string)

Source from the content-addressed store, hash-verified

9var errEmptyJSONFlag = errors.New("empty JSON flag")
10
11func parseRequiredJSONRawMessage(raw string) (json.RawMessage, error) {
12 trimmed := strings.TrimSpace(raw)
13 if trimmed == "" {
14 return nil, errEmptyJSONFlag
15 }
16 var decoded any
17 if err := json.Unmarshal([]byte(trimmed), &decoded); err != nil {
18 return nil, err
19 }
20 return json.RawMessage(trimmed), nil
21}

Callers 3

parseJSONFlagFunction · 0.85
parseNetworkJSONValueFunction · 0.85

Calls

no outgoing calls

Tested by 1