MCPcopy Create free account
hub / github.com/PostHog/duckgres / isJSON

Function isJSON

tests/integration/compare.go:457–465  ·  view source on GitHub ↗

isJSON checks if a value looks like JSON

(v interface{})

Source from the content-addressed store, hash-verified

455
456// isJSON checks if a value looks like JSON
457func isJSON(v interface{}) bool {
458 str, ok := v.(string)
459 if !ok {
460 return false
461 }
462 str = strings.TrimSpace(str)
463 return (strings.HasPrefix(str, "{") && strings.HasSuffix(str, "}")) ||
464 (strings.HasPrefix(str, "[") && strings.HasSuffix(str, "]"))
465}
466
467// jsonEqual compares two JSON values
468func jsonEqual(a, b interface{}) bool {

Callers 1

valuesEqualFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected