MCPcopy Create free account

hub / github.com/buger/jsonparser / functions

Functions1,168 in github.com/buger/jsonparser

↓ 204 callersFunctionGet
* Get - Receives data structure, and key path to extract value from. Returns: `value` - Pointer to original data structure containing key value, or j
parser.go:1564
↓ 72 callersFunctionArrayEach
SYS-REQ-006, SYS-REQ-028, SYS-REQ-029, SYS-REQ-052, SYS-REQ-053, SYS-REQ-055, SYS-REQ-083 ArrayEach is used when iterating arrays, accepts a callback
parser.go:1604
↓ 71 callersFunctionDelete
* Del - Receives existing data structure, path to delete. Returns: `data` - return modified data */ SYS-REQ-010, SYS-REQ-033, SYS-REQ-034, SYS-REQ-
parser.go:1182
↓ 68 callersFunctionSet
* Set - Receives existing data structure, path to set, and data to set at that key. Returns: `value` - modified byte array `err` - On any parsing er
parser.go:1341
↓ 51 callersFunctionGetString
SYS-REQ-002, SYS-REQ-071, SYS-REQ-072, SYS-REQ-073, SYS-REQ-074 GetString returns the value retrieved by `Get`, cast to a string if possible, trying t
parser.go:1947
↓ 48 callersFunctionEachKey
SYS-REQ-008, SYS-REQ-085, SYS-REQ-111
parser.go:587
↓ 48 callersFunctionObjectEach
SYS-REQ-007, SYS-REQ-030, SYS-REQ-031, SYS-REQ-032, SYS-REQ-054, SYS-REQ-084 ObjectEach iterates over the key-value pairs of a JSON object, invoking a
parser.go:1810
↓ 46 callersFunctionGetInt
GetInt returns the value retrieved by `Get`, cast to a int64 if possible. If key data type do not match, it will return an error. SYS-REQ-003, SYS-REQ
parser.go:1993
↓ 45 callersMethodString
SYS-REQ-001
parser.go:1046
↓ 44 callersFunctionParseInt
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
parser.go:2067
↓ 41 callersFunctionParseString
ParseString parses a String ValueType into a Go string (the main parsing work is unescaping the JSON string) SYS-REQ-014, SYS-REQ-038, SYS-REQ-060, SY
parser.go:2046
↓ 34 callersFunctionnothing
Just for emulating field access, so it will not throw "evaluated but not used" Benchmark helper for STK-REQ-001, STK-REQ-003, STK-REQ-004, STK-REQ-005
benchmark/benchmark_small_payload_test.go:28
↓ 33 callersFunctionGetUnsafeString
SYS-REQ-011, SYS-REQ-080, SYS-REQ-081, SYS-REQ-082 GetUnsafeString returns the value retrieved by `Get`, use creates string without memory allocation
parser.go:1934
↓ 24 callersFunctionParseBoolean
ParseBoolean parses a Boolean ValueType into a Go bool (not particularly useful, but here for completeness) SYS-REQ-012, SYS-REQ-036, SYS-REQ-057, SYS
parser.go:2033
↓ 19 callersFunctionUnescape
unescape unescapes the string contained in 'in' and returns it as a slice. If 'in' contains no escaped characters: Returns 'in'. Else, if 'out' is
escape.go:284
↓ 18 callersFunctionnewRNG
(seed int64)
property_test.go:38
↓ 17 callersFunctionGetBoolean
GetBoolean returns the value retrieved by `Get`, cast to a bool if possible. The offset is the same as in `Get`. If key data type do not match, it wil
parser.go:2014
↓ 17 callersFunctionParseFloat
ParseNumber parses a Number ValueType into a Go float64 SYS-REQ-013, SYS-REQ-037, SYS-REQ-065
parser.go:2057
↓ 14 callersFunctionaddSeeds
(f *testing.F)
fuzz_native_test.go:52
↓ 14 callersFunctionrunNoPanic
Regression coverage for the empty-string key path component hazard (hazard-sweep finding). A caller passing "" as a path component used to trigger `ru
empty_key_path_test.go:23
↓ 14 callersFunctionrunWithCapture
(target string, data []byte, fn func([]byte))
fuzz_native_test.go:103
↓ 13 callersMethodGet
Get returns the value addressed by keys using c's parsing options. SYS-REQ-115
config.go:31
↓ 12 callersFunctionGetFloat
GetFloat returns the value retrieved by `Get`, cast to a float64 if possible. The offset is the same as in `Get`. If key data type do not match, it wi
parser.go:1973
↓ 11 callersMethodCodecDecodeSelf
Benchmark harness support for STK-REQ-004.
benchmark/benchmark_codecgen.go:1112
↓ 11 callersFunctionstringEnd
SYS-REQ-045 Tries to find the end of string Support if string contains escaped quote symbols.
parser.go:296
↓ 11 callersFunctiontokenEnd
SYS-REQ-044 reqproof:lemma tokenEnd_in_range func(data []byte) bool { r := tokenEnd(data) return r >= 0 && r <= len(data) } reqproof:lemma
parser.go:55
↓ 10 callersMethodpeekByte
peekByte returns the next byte. When retain is false, fully consumed chunks are discarded before reading more data. SYS-REQ-116
reader_parser.go:609
↓ 10 callersFunctionsearchKeys
SYS-REQ-001, SYS-REQ-020, SYS-REQ-021, SYS-REQ-022, SYS-REQ-023, SYS-REQ-047, SYS-REQ-111
parser.go:408
↓ 9 callersMethodGetString
GetString returns the decoded string addressed by keys using c's parsing options. SYS-REQ-115
config.go:39
↓ 9 callersFunctionNewReaderParser
NewReaderParser creates a streaming parser. If opts contains a Config, the first Config controls lenient parsing and the sliding-window size. SYS-REQ-
reader_parser.go:37
↓ 8 callersMethodUnmarshalEasyJSON
Benchmark harness support for STK-REQ-004.
benchmark/benchmark_easyjson.go:283
↓ 8 callersFunctionnextTokenConfig
SYS-REQ-115
parser.go:241
↓ 8 callersFunctionrandKey
(r *mathrand.Rand)
property_test.go:83
↓ 7 callersMethodGet
Get returns the value addressed by keys without loading the whole document. As with the package-level Get, string values are returned without quotes b
reader_parser.go:52
↓ 7 callersFunctionnextToken
SYS-REQ-001 Find position of next character which is not whitespace reqproof:lemma nextToken_in_range func(data []byte) bool { r := nextToken(dat
parser.go:236
↓ 7 callersFunctionrunGetTests
Test helper for SYS-REQ-001, SYS-REQ-002, SYS-REQ-003, SYS-REQ-004, SYS-REQ-005, and SYS-REQ-011.
parser_test.go:1233
↓ 7 callersFunctionunescapeConfig
SYS-REQ-115
escape.go:289
↓ 6 callersFunctionArrayEachErr
ArrayEachErr is used when iterating arrays and allows the callback to stop iteration by returning an error. io.EOF stops iteration without returning a
parser.go:1713
↓ 6 callersMethodCodecEncodeSelf
Benchmark harness support for STK-REQ-004.
benchmark/benchmark_codecgen.go:1053
↓ 6 callersFunctionCompilePath
CompilePath parses jsonPath once for reuse. SYS-REQ-114
path_compiler.go:167
↓ 6 callersMethodMarshalJSONBuf
Benchmark harness support for STK-REQ-004.
benchmark/benchmark_ffjson.go:685
↓ 6 callersFunctionassertInputUnchanged
(t *testing.T, data []byte, fn func())
property_test.go:151
↓ 6 callersFunctionencodingJSONNoPanic
============================================================================= Shared helpers =========================================================
encoding_json_fuzz_test.go:113
↓ 6 callersFunctionrandomBytes
randomBytes returns arbitrary (usually non-JSON) bytes from a seeded RNG.
property_test.go:131
↓ 6 callersFunctionrecoverNoPanic
recoverNoPanic runs fn and reports whether it returned without panicking.
property_test.go:141
↓ 6 callersMethodskipWhitespace
SYS-REQ-116
reader_parser.go:593
↓ 6 callersFunctionsplitPathComponents
splitPathComponents interprets the fuzz path bytes as a '/'-separated list of key components. Empty segments (from "", "a/", "/a", "a//b", etc.) becom
path_fuzz_test.go:119
↓ 6 callersFunctionstringEndConfig
SYS-REQ-115
parser.go:301
↓ 6 callersFunctiontruncateForMsg
truncateForMsg renders a byte slice for inclusion in an error message, truncating very large inputs (e.g. the 100 KB deep-nesting seed) so test output
encoding_json_fuzz_test.go:127
↓ 5 callersFunctionEscape
Escape returns in as a JSON string literal, including the surrounding quotation marks. SYS-REQ-014
escape.go:230
↓ 5 callersMethodMarshalEasyJSON
Benchmark harness support for STK-REQ-004.
benchmark/benchmark_easyjson.go:278
↓ 5 callersFunctionParsePath
ParsePath converts a JSONPath-style path into the path components accepted by Get, Set, Delete, ArrayEach, and EachKey. SYS-REQ-114
path_compiler.go:17
↓ 5 callersFunctioncreateInsertComponent
SYS-REQ-009, SYS-REQ-110, SYS-REQ-111
parser.go:1074
↓ 5 callersFunctiondecodeSingleUnicodeEscape
decodeSingleUnicodeEscape decodes a single \uXXXX escape sequence. The prefix \u is assumed to be present and is not checked. In JSON, these escapes c
escape.go:82
↓ 5 callersFunctiondecodeUnicodeEscape
SYS-REQ-115
escape.go:123
↓ 5 callersFunctionequalStr
See fastbytes_unsafe.go for explanation on why *[]byte is used (signatures must be consistent with those in that file)
bytes_safe.go:12
↓ 5 callersFunctiongenDeepNesting
genDeepNesting returns deeply-nested JSON array bytes. When closed is true the structure is complete ([[[...1...]]]); when false it is left unclosed (
encoding_json_fuzz_test.go:139
↓ 5 callersFunctionoracleNewRNG
oracleNewRNG returns a seeded RNG. Distinct name from property_test.go's newRNG so the two files can evolve independently without collision.
reference_oracle_test.go:119
↓ 5 callersFunctionrandomJSONValue
randomJSONValue builds a random nested Go value suitable for encoding/json.Marshal. The shape (depth, breadth, alternatives) is chosen by the supplied
property_test.go:45
↓ 4 callersMethodError
SYS-REQ-116
reader_parser.go:694
↓ 4 callersFunctionGetArrayLen
GetArrayLen returns the number of elements in the addressed JSON array. It scans the array without invoking a callback. SYS-REQ-112
parser.go:2081
↓ 4 callersMethodSet
Set replaces the value addressed by keys using c's parsing options. SYS-REQ-115
config.go:66
↓ 4 callersMethodUnmarshalJSONFFLexer
Benchmark harness support for STK-REQ-004.
benchmark/benchmark_ffjson.go:716
↓ 4 callersFunctionapplyMutation
applyMutation picks one operator at random and applies it.
json_fuzz_test.go:544
↓ 4 callersFunctionblockEnd
SYS-REQ-046 Find end of the data structure, array or object. For array openSym and closeSym will be '[' and ']', for object '{' and '}'
parser.go:369
↓ 4 callersFunctionblockEndConfig
SYS-REQ-115
parser.go:374
↓ 4 callersFunctionbytesToString
(b *[]byte)
bytes_safe.go:20
↓ 4 callersFunctioncalcAllocateSpace
SYS-REQ-009, SYS-REQ-111
parser.go:1125
↓ 4 callersFunctionfindKeyStart
SYS-REQ-001, SYS-REQ-020, SYS-REQ-024
parser.go:96
↓ 4 callersFunctionfindStructuralBytes
findStructuralBytes returns the positions of all bytes in data that match any of targets. Returns nil if none are found.
json_fuzz_test.go:554
↓ 4 callersFunctiongenJSON
genJSON returns a valid JSON document generated from the grammar. The output is always valid JSON per RFC 8259 (the corpus-sanity test asserts json.Va
json_fuzz_test.go:156
↓ 4 callersFunctioninternalGetConfig
SYS-REQ-115
parser.go:1575
↓ 4 callersFunctionlastToken
SYS-REQ-001 Find position of last character which is not whitespace reqproof:lemma lastToken_in_range func(data []byte) bool { r := lastToken(dat
parser.go:279
↓ 4 callersFunctionparseInt
About 2x faster then strconv.ParseInt because it only supports base 10, which is enough for JSON
bytes.go:9
↓ 4 callersFunctionrandomObjectJSONBytes
randomObjectJSONBytes returns marshaled JSON for a random top-level object along with the map so tests can predict values.
property_test.go:105
↓ 4 callersFunctionsearchKeysConfig
SYS-REQ-115
parser.go:413
↓ 4 callersFunctiontokenStart
SYS-REQ-001 reqproof:lemma tokenStart_in_range func(data []byte) bool { r := tokenStart(data) return r >= 0 && r <= len(data) } reqproof:le
parser.go:197
↓ 3 callersFunctionArrayEachWildcard
ArrayEachWildcard iterates over an array addressed by keys. A terminal [*] component is accepted as an explicit request for all elements; without it,
wildcard.go:72
↓ 3 callersFunctionGetObjectLen
GetObjectLen returns the number of key-value pairs in the addressed JSON object. It scans the object without invoking a callback. SYS-REQ-112
parser.go:2093
↓ 3 callersMethodGetString
GetString returns and decodes the string addressed by keys. SYS-REQ-116
reader_parser.go:89
↓ 3 callersFunctionSetString
SetString replaces the value at keys with val encoded as a JSON string. SYS-REQ-009
escape.go:268
↓ 3 callersFunctionaliasErrorString
(err error)
aliases_test.go:31
↓ 3 callersFunctionarrayEachConfig
SYS-REQ-115
parser.go:1609
↓ 3 callersMethodcaptureValue
SYS-REQ-116
reader_parser.go:438
↓ 3 callersFunctiondeleteFoundConfig
SYS-REQ-115
parser.go:1195
↓ 3 callersMethoddiscardConsumed
SYS-REQ-116
reader_parser.go:674
↓ 3 callersFunctionfindTokenStart
SYS-REQ-001 NOTE: findTokenStart's two-conditional-return body shape exposes the translator's __early_val scoping bug; we leave it without an in-range
parser.go:82
↓ 3 callersMethodfindValue
findValue resolves keys[depth:] against the value at rp.pos. A not-found result consumes the current value so a containing object can continue past a
reader_parser.go:201
↓ 3 callersFunctiongenValue
genValue appends one JSON value to buf, chosen from a weighted distribution that favors containers at shallow depth (to exercise nesting) and scalars
json_fuzz_test.go:165
↓ 3 callersFunctioninternalGet
SYS-REQ-001
parser.go:1570
↓ 3 callersFunctionisJSONWhitespace
isJSONWhitespace reports whether b is one of the four JSON whitespace bytes (space 0x20, tab 0x09, LF 0x0A, CR 0x0D) per RFC 8259 §2. Used by Delete's
parser.go:74
↓ 3 callersFunctionnewRandFromSeed
============================================================================= Deterministic RNG seeding from fuzz inputs =============================
json_fuzz_test.go:129
↓ 3 callersFunctionoracleRandomJSONBytes
oracleRandomJSONBytes returns marshaled JSON for a random value, plus the Go value itself (so callers can walk the tree to predict sub-values).
reference_oracle_test.go:256
↓ 3 callersFunctionpathShapeMatchesRoot
pathShapeMatchesRoot reports whether the path is semantically applicable to the JSON data's container structure. Used to gate the json.Valid post-cond
path_fuzz_test.go:411
↓ 3 callersFunctionpickExistingPath
--------------------------------------------------------------------------- Path picker — walks a random Go value tree to produce a path that EXISTS.
reference_oracle_test.go:270
↓ 3 callersFunctionrandomJSONBytes
randomJSONBytes returns marshaled JSON for any random value.
property_test.go:121
↓ 3 callersFunctionreferenceStringEnd
============================================================================= Focused equivalence tests for the stringEnd fast path (PR #285-style "fa
optimization_equiv_test.go:26
↓ 3 callersFunctionrunParseTests
Test helper for SYS-REQ-012, SYS-REQ-013, SYS-REQ-014, and SYS-REQ-015.
parser_test.go:2193
↓ 3 callersFunctionsameTree
SYS-REQ-008
parser.go:569
↓ 3 callersMethodscanString
SYS-REQ-116
reader_parser.go:482
next →1–100 of 1,168, ranked by callers