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

Function ParseInt

parser.go:2107–2116  ·  view source on GitHub ↗

ParseInt parses a Number ValueType into a Go int64 SYS-REQ-015, SYS-REQ-039, SYS-REQ-040, SYS-REQ-058, SYS-REQ-059, SYS-REQ-064

(b []byte)

Source from the content-addressed store, hash-verified

2105// ParseInt parses a Number ValueType into a Go int64
2106// SYS-REQ-015, SYS-REQ-039, SYS-REQ-040, SYS-REQ-058, SYS-REQ-059, SYS-REQ-064
2107func ParseInt(b []byte) (int64, error) {
2108 if v, ok, overflow := parseInt(b); !ok {
2109 if overflow {
2110 return 0, OverflowIntegerError
2111 }
2112 return 0, MalformedValueError
2113 } else {
2114 return v, nil
2115 }
2116}
2117
2118// GetArrayLen returns the number of elements in the addressed JSON array.
2119// It scans the array without invoking a callback.

Calls 1

parseIntFunction · 0.85