MCPcopy
hub / github.com/keploy/keploy / UnmarshallJSON

Function UnmarshallJSON

pkg/matcher/utils.go:716–726  ·  view source on GitHub ↗

UnmarshallJSON returns unmarshalled JSON object.

(s string, log *zap.Logger)

Source from the content-addressed store, hash-verified

714
715// UnmarshallJSON returns unmarshalled JSON object.
716func UnmarshallJSON(s string, log *zap.Logger) (interface{}, error) {
717 var result interface{}
718 if s == "" {
719 return nil, nil
720 }
721 if err := json.Unmarshal([]byte(s), &result); err != nil {
722 utils.LogError(log, err, "cannot convert json string into json object", zap.String("json", s))
723 return nil, err
724 }
725 return result, nil
726}
727
728// maxLineLength is chars PER expected/actual string. Can be changed no problem
729const maxLineLength = 50

Callers 1

ValidateAndMarshalJSONFunction · 0.85

Calls 3

LogErrorFunction · 0.92
UnmarshalMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected