MCPcopy Create free account

hub / github.com/tidwall/gjson / functions

Functions214 in github.com/tidwall/gjson

↓ 343 callersFunctionassert
(t testing.TB, cond bool)
gjson_test.go:662
↓ 245 callersFunctionGet
Get searches json for the specified path. A path is in dot syntax, such as "name.last" or "age". When the value is found it's returned immediately. A
gjson.go:2130
↓ 216 callersMethodString
String returns a string representation of the type.
gjson.go:42
↓ 70 callersFunctiontestvalid
(t *testing.T, json string, expect bool)
gjson_test.go:1018
↓ 65 callersFunctionParse
Parse parses the json and returns a result. This function expects that the json is well-formed, and does not validate. Invalid json will not panic, b
gjson.go:471
↓ 50 callersFunctionget
(json, path string)
gjson_test.go:273
↓ 36 callersMethodInt
Int returns an integer representation.
gjson.go:125
↓ 33 callersMethodExists
Exists returns true if value exists. if gjson.Get(json, "name.last").Exists(){ println("value exists") }
gjson.go:658
↓ 30 callersMethodForEach
ForEach iterates through values. If the result represents a non-existent value, then no values will be iterated. If the result is an Object, the itera
gjson.go:234
↓ 27 callersFunctionrevSquash
(json string)
gjson.go:3372
↓ 26 callersFunctionstringLessInsensitive
(a, b string)
gjson.go:2336
↓ 24 callersMethodBool
Bool returns an boolean representation.
gjson.go:110
↓ 23 callersMethodGet
Get searches result for the specified path. The result should be a JSON array or object.
gjson.go:323
↓ 20 callersMethodArray
Array returns back an array of values. If the result represents a null value or is non-existent, then an empty array will be returned. If the result i
gjson.go:202
↓ 16 callersMethodFloat
Float returns an float64 representation.
gjson.go:177
↓ 14 callersMethodLess
Less return true if a token is less than another token. The caseSensitive parameter is used when the tokens are Strings. The order when comparing two
gjson.go:2317
↓ 13 callersMethodIsArray
IsArray returns true if the result value is a JSON array.
gjson.go:219
↓ 13 callersMethodValue
Value returns one of these types: bool, for JSON booleans float64, for JSON numbers Number, for JSON numbers string, for JSON string literals ni
gjson.go:671
↓ 12 callersMethodMap
Map returns back a map of values. The result should be a JSON object. If the result is not a JSON object, the return value will be an empty map.
gjson.go:313
↓ 12 callersFunctionsquash
(json string)
gjson.go:524
↓ 12 callersFunctionunescape
unescape unescapes a string
gjson.go:2254
↓ 10 callersFunctionGetMany
GetMany searches json for the multiple paths. The return value is a Result array where the number of items will be equal to the number of input paths.
gjson.go:2454
↓ 10 callersMethodUint
Uint returns an unsigned integer representation.
gjson.go:151
↓ 10 callersFunctiontestMany
(t *testing.T, json string, paths, expected []string)
gjson_test.go:870
↓ 9 callersMethodIsObject
IsObject returns true if the result value is a JSON object.
gjson.go:214
↓ 9 callersMethodPath
Path returns the original GJSON path for a Result where the Result came from a simple path that returns a single value, like: gjson.Get(json, "frien
gjson.go:3463
↓ 9 callersFunctiontestEscapePath
(t *testing.T, json, path, expect string)
gjson_test.go:78
↓ 8 callersMethodString
String returns a string representation of the value.
gjson.go:79
↓ 8 callersFunctiontestJSONString
(t *testing.T, str string)
gjson_test.go:2560
↓ 7 callersFunctionbytesString
(b []byte)
gjson.go:3368
↓ 6 callersFunctionGetBytes
GetBytes searches json for the specified path. If working with bytes, this method preferred over Get(string(data), path)
gjson.go:2243
↓ 6 callersFunctionparseQuery
splitQuery takes a query and splits it into three parts: path, op, middle, and right. So for this query: #(first_name=="Murphy").last Becomes
gjson.go:857
↓ 6 callersFunctionparseSquash
(json string, i int)
gjson.go:1054
↓ 6 callersFunctiontolit
(json string)
gjson.go:600
↓ 5 callersFunctionAppendJSONString
AppendJSONString is a convenience function that converts the provided string to a valid JSON string and appends it to dst.
gjson.go:2037
↓ 5 callersFunctionParseBytes
ParseBytes parses the json and returns a result. If working with bytes, this method preferred over Parse(string(data))
gjson.go:520
↓ 5 callersFunctionValid
Valid returns true if the input is valid json. if !gjson.Valid(json) { return errors.New("invalid json") } value := gjson.Get(json, "name.last")
gjson.go:2749
↓ 5 callersFunctiontrim
(s string)
gjson.go:939
↓ 5 callersFunctionvalidpayload
(data []byte, i int)
gjson.go:2473
↓ 4 callersFunctionAddModifier
AddModifier binds a custom modifier command to the GJSON syntax. This operation is not thread safe and should be executed prior to using all other gjs
gjson.go:2942
↓ 4 callersFunctionmatchLimit
matchLimit will limit the complexity of the match operation to avoid ReDos attacks from arbitrary inputs. See the github.com/tidwall/match.MatchLimit
gjson.go:1362
↓ 4 callersFunctionparseString
(json string, i int)
gjson.go:695
↓ 4 callersFunctionstringBytes
(s string)
gjson.go:3360
↓ 3 callersFunctionEscape
Escape returns an escaped path component. json := `{ "user":{ "first.name": "Janet", "last.name": "Prichard" } }` user := gjson
gjson.go:3567
↓ 3 callersFunctionGetManyBytes
GetManyBytes searches json for the multiple paths. The return value is a Result array where the number of items will be equal to the number of input p
gjson.go:2465
↓ 3 callersMethodPaths
Paths returns the original GJSON paths for a Result where the Result came from a simple query path that returns an array, like: gjson.Get(json, "fri
gjson.go:3434
↓ 3 callersMethodarrayOrMap
(vc byte, valueize bool)
gjson.go:343
↓ 3 callersFunctionfillIndex
fillIndex finds the position of Raw data and assigns it to the Index field of the resulting value. If the position cannot be found then Index zero is
gjson.go:3349
↓ 3 callersFunctionisDotPiperChar
peek at the next byte and see if it's a '@', '[', or '{'.
gjson.go:954
↓ 3 callersFunctionparseAny
parseAny parses the next value from a json string. A Result is returned when the hit param is set. The return values are (i int, res Result, ok bool)
gjson.go:2376
↓ 3 callersFunctionparseArray
(c *parseContext, i int, path string)
gjson.go:1508
↓ 3 callersFunctionparseLiteral
(json string, i int)
gjson.go:745
↓ 3 callersFunctionparseNumber
(json string, i int)
gjson.go:733
↓ 3 callersFunctionparseUint
(s string)
gjson.go:2767
↓ 3 callersFunctionsplitPossiblePipe
(path string)
gjson.go:1817
↓ 3 callersFunctiontonum
(json string)
gjson.go:577
↓ 3 callersFunctionunwrap
unwrap removes the '[]' or '{}' characters around json
gjson.go:2908
↓ 3 callersFunctionvalidany
(data []byte, i int)
gjson.go:2496
↓ 2 callersFunctionappendHex16
(dst []byte, x uint16)
gjson.go:2018
↓ 2 callersFunctioncleanWS
cleanWS remove any non-whitespace from string
gjson.go:2953
↓ 2 callersFunctionisSafePathKeyChar
isSafePathKeyChar returns true if the input character is safe for not needing escaping.
gjson.go:3547
↓ 2 callersFunctionparseInt
(s string)
gjson.go:2782
↓ 2 callersFunctionparseObject
(c *parseContext, i int, path string)
gjson.go:1196
↓ 2 callersFunctionruneit
runeit returns the rune from the the \uXXXX
gjson.go:2248
↓ 2 callersFunctionsafeInt
safeInt validates a given JSON number ensures it lies within the minimum and maximum representable JSON numbers
gjson.go:2807
↓ 2 callersFunctiontestManyAny
(t *testing.T, json string, paths, expected []string, bytes bool)
gjson_test.go:874
↓ 2 callersFunctiontostr
(json string)
gjson.go:609
↓ 2 callersFunctionvalidcomma
(data []byte, i int, end byte)
gjson.go:2576
↓ 2 callersFunctionvalidstring
(data []byte, i int)
gjson.go:2614
↓ 1 callersMethodAll
All iterates over a json result. This works identically to ForEach, but allows modern Go loops: for key, value := range res.All() { fmt.Printf("%s
gjson.go:3618
↓ 1 callersFunctionForEachLine
ForEachLine iterates through lines of JSON as specified by the JSON Lines format (http://jsonlines.org/). Each line is returned as a GJSON Result.
gjson.go:1902
↓ 1 callersMethodKeys
Keys iterates over a json result. This works identically to ForEach, but allows modern Go loops: for key := range res.Keys() { fmt.Printf("%s\n",
gjson.go:3630
↓ 1 callersMethodTime
Time returns a time.Time representation.
gjson.go:192
↓ 1 callersFunctionValidBytes
ValidBytes returns true if the input is valid json. if !gjson.Valid(json) { return errors.New("invalid json") } value := gjson.Get(json, "name.l
gjson.go:2762
↓ 1 callersMethodValues
Values iterates over a json result. This works identically to ForEach, but allows modern Go loops: for value := range res.Values() { fmt.Printf("%
gjson.go:3644
↓ 1 callersFunctionexecModifier
execModifier parses the path to find a matching modifier function. The input expects that the path already starts with a '@'
gjson.go:2850
↓ 1 callersFunctionexecStatic
execStatic parses the path to find a static value. The input expects that the path already starts with a '!'
gjson.go:2818
↓ 1 callersFunctionfalseish
(t Result)
gjson.go:1367
↓ 1 callersFunctiongetBytes
getBytes casts the input json bytes to a string and safely returns the results as uniquely allocated data. This operation is intended to minimize copi
gjson.go:3302
↓ 1 callersFunctiongoJSONMarshal
(i interface{})
gjson_test.go:2552
↓ 1 callersFunctionisSimpleName
(component string)
gjson.go:2000
↓ 1 callersFunctionmakeRandomJSONChars
(b []byte)
gjson_test.go:1103
↓ 1 callersFunctionnameOfLast
nameOfLast returns the name of the last component
gjson.go:1986
↓ 1 callersFunctionnullish
(t Result)
gjson.go:1403
↓ 1 callersFunctionparseArrayPath
(path string)
gjson.go:774
↓ 1 callersFunctionparseObjectPath
(path string)
gjson.go:982
↓ 1 callersFunctionparseRecursiveDescent
(all []Result, parent Result, path string)
gjson.go:3585
↓ 1 callersFunctionparseSubSelectors
parseSubSelectors returns the subselectors belonging to a '[path1,path2]' or '{"field1":path1,"field2":path2}' type subSelection. It's expected that t
gjson.go:1925
↓ 1 callersFunctionqueryMatches
(rp *arrayPathResult, value Result)
gjson.go:1407
↓ 1 callersFunctiontrueish
(t Result)
gjson.go:1386
↓ 1 callersFunctionvalidarray
(data []byte, i int)
gjson.go:2591
↓ 1 callersFunctionvalidcolon
(data []byte, i int)
gjson.go:2563
↓ 1 callersFunctionvalidfalse
(data []byte, i int)
gjson.go:2728
↓ 1 callersFunctionvalidnull
(data []byte, i int)
gjson.go:2735
↓ 1 callersFunctionvalidnumber
(data []byte, i int)
gjson.go:2646
↓ 1 callersFunctionvalidobject
(data []byte, i int)
gjson.go:2521
↓ 1 callersFunctionvalidtrue
(data []byte, i int)
gjson.go:2721
FunctionBenchmarkGoStdlibValidBytes
(b *testing.B)
gjson_test.go:1373
FunctionBenchmarkValid
(b *testing.B)
gjson_test.go:1360
FunctionBenchmarkValidBytes
(b *testing.B)
gjson_test.go:1366
next →1–100 of 214, ranked by callers