MCPcopy
hub / github.com/tidwall/gjson / Valid

Function Valid

gjson.go:2749–2752  ·  view source on GitHub ↗

Valid returns true if the input is valid json. if !gjson.Valid(json) { return errors.New("invalid json") } value := gjson.Get(json, "name.last")

(json string)

Source from the content-addressed store, hash-verified

2747// }
2748// value := gjson.Get(json, "name.last")
2749func Valid(json string) bool {
2750 _, ok := validpayload(stringBytes(json), 0)
2751 return ok
2752}
2753
2754// ValidBytes returns true if the input is valid json.
2755//

Callers 5

TestDuplicateKeysFunction · 0.85
BenchmarkValidFunction · 0.85
GetFunction · 0.85
modValidFunction · 0.85
modFromStrFunction · 0.85

Calls 2

validpayloadFunction · 0.85
stringBytesFunction · 0.85

Tested by 2

TestDuplicateKeysFunction · 0.68
BenchmarkValidFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…