MCPcopy Create free account
hub / github.com/buger/jsonparser / GetObjectLen

Function GetObjectLen

parser.go:2001–2008  ·  view source on GitHub ↗

GetObjectLen returns the number of key-value pairs in the addressed JSON object. It scans the object without invoking a callback. SYS-REQ-112

(data []byte, keys ...string)

Source from the content-addressed store, hash-verified

1999// object. It scans the object without invoking a callback.
2000// SYS-REQ-112
2001func GetObjectLen(data []byte, keys ...string) (int, error) {
2002 offset, err := containerStart(data, '{', keys...)
2003 if err != nil {
2004 return 0, err
2005 }
2006
2007 return scanContainerLen(data, offset, '{')
2008}
2009
2010// GetUint64 returns the value retrieved by internalGet, cast to a uint64 if
2011// possible. Negative values and malformed integers return MalformedValueError;

Callers 3

TestGetObjectLenFunction · 0.85

Calls 2

containerStartFunction · 0.85
scanContainerLenFunction · 0.85

Tested by 3

TestGetObjectLenFunction · 0.68