Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/tidwall/gjson
/ functions
Functions
214 in github.com/tidwall/gjson
⨍
Functions
214
◇
Types & classes
9
↓ 343 callers
Function
assert
(t testing.TB, cond bool)
gjson_test.go:662
↓ 245 callers
Function
Get
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 callers
Method
String
String returns a string representation of the type.
gjson.go:42
↓ 70 callers
Function
testvalid
(t *testing.T, json string, expect bool)
gjson_test.go:1018
↓ 65 callers
Function
Parse
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 callers
Function
get
(json, path string)
gjson_test.go:273
↓ 36 callers
Method
Int
Int returns an integer representation.
gjson.go:125
↓ 33 callers
Method
Exists
Exists returns true if value exists. if gjson.Get(json, "name.last").Exists(){ println("value exists") }
gjson.go:658
↓ 30 callers
Method
ForEach
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 callers
Function
revSquash
(json string)
gjson.go:3372
↓ 26 callers
Function
stringLessInsensitive
(a, b string)
gjson.go:2336
↓ 24 callers
Method
Bool
Bool returns an boolean representation.
gjson.go:110
↓ 23 callers
Method
Get
Get searches result for the specified path. The result should be a JSON array or object.
gjson.go:323
↓ 20 callers
Method
Array
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 callers
Method
Float
Float returns an float64 representation.
gjson.go:177
↓ 14 callers
Method
Less
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 callers
Method
IsArray
IsArray returns true if the result value is a JSON array.
gjson.go:219
↓ 13 callers
Method
Value
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 callers
Method
Map
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 callers
Function
squash
(json string)
gjson.go:524
↓ 12 callers
Function
unescape
unescape unescapes a string
gjson.go:2254
↓ 10 callers
Function
GetMany
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 callers
Method
Uint
Uint returns an unsigned integer representation.
gjson.go:151
↓ 10 callers
Function
testMany
(t *testing.T, json string, paths, expected []string)
gjson_test.go:870
↓ 9 callers
Method
IsObject
IsObject returns true if the result value is a JSON object.
gjson.go:214
↓ 9 callers
Method
Path
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 callers
Function
testEscapePath
(t *testing.T, json, path, expect string)
gjson_test.go:78
↓ 8 callers
Method
String
String returns a string representation of the value.
gjson.go:79
↓ 8 callers
Function
testJSONString
(t *testing.T, str string)
gjson_test.go:2560
↓ 7 callers
Function
bytesString
(b []byte)
gjson.go:3368
↓ 6 callers
Function
GetBytes
GetBytes searches json for the specified path. If working with bytes, this method preferred over Get(string(data), path)
gjson.go:2243
↓ 6 callers
Function
parseQuery
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 callers
Function
parseSquash
(json string, i int)
gjson.go:1054
↓ 6 callers
Function
tolit
(json string)
gjson.go:600
↓ 5 callers
Function
AppendJSONString
AppendJSONString is a convenience function that converts the provided string to a valid JSON string and appends it to dst.
gjson.go:2037
↓ 5 callers
Function
ParseBytes
ParseBytes parses the json and returns a result. If working with bytes, this method preferred over Parse(string(data))
gjson.go:520
↓ 5 callers
Function
Valid
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 callers
Function
trim
(s string)
gjson.go:939
↓ 5 callers
Function
validpayload
(data []byte, i int)
gjson.go:2473
↓ 4 callers
Function
AddModifier
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 callers
Function
matchLimit
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 callers
Function
parseString
(json string, i int)
gjson.go:695
↓ 4 callers
Function
stringBytes
(s string)
gjson.go:3360
↓ 3 callers
Function
Escape
Escape returns an escaped path component. json := `{ "user":{ "first.name": "Janet", "last.name": "Prichard" } }` user := gjson
gjson.go:3567
↓ 3 callers
Function
GetManyBytes
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 callers
Method
Paths
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 callers
Method
arrayOrMap
(vc byte, valueize bool)
gjson.go:343
↓ 3 callers
Function
fillIndex
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 callers
Function
isDotPiperChar
peek at the next byte and see if it's a '@', '[', or '{'.
gjson.go:954
↓ 3 callers
Function
parseAny
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 callers
Function
parseArray
(c *parseContext, i int, path string)
gjson.go:1508
↓ 3 callers
Function
parseLiteral
(json string, i int)
gjson.go:745
↓ 3 callers
Function
parseNumber
(json string, i int)
gjson.go:733
↓ 3 callers
Function
parseUint
(s string)
gjson.go:2767
↓ 3 callers
Function
splitPossiblePipe
(path string)
gjson.go:1817
↓ 3 callers
Function
tonum
(json string)
gjson.go:577
↓ 3 callers
Function
unwrap
unwrap removes the '[]' or '{}' characters around json
gjson.go:2908
↓ 3 callers
Function
validany
(data []byte, i int)
gjson.go:2496
↓ 2 callers
Function
appendHex16
(dst []byte, x uint16)
gjson.go:2018
↓ 2 callers
Function
cleanWS
cleanWS remove any non-whitespace from string
gjson.go:2953
↓ 2 callers
Function
isSafePathKeyChar
isSafePathKeyChar returns true if the input character is safe for not needing escaping.
gjson.go:3547
↓ 2 callers
Function
parseInt
(s string)
gjson.go:2782
↓ 2 callers
Function
parseObject
(c *parseContext, i int, path string)
gjson.go:1196
↓ 2 callers
Function
runeit
runeit returns the rune from the the \uXXXX
gjson.go:2248
↓ 2 callers
Function
safeInt
safeInt validates a given JSON number ensures it lies within the minimum and maximum representable JSON numbers
gjson.go:2807
↓ 2 callers
Function
testManyAny
(t *testing.T, json string, paths, expected []string, bytes bool)
gjson_test.go:874
↓ 2 callers
Function
tostr
(json string)
gjson.go:609
↓ 2 callers
Function
validcomma
(data []byte, i int, end byte)
gjson.go:2576
↓ 2 callers
Function
validstring
(data []byte, i int)
gjson.go:2614
↓ 1 callers
Method
All
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 callers
Function
ForEachLine
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 callers
Method
Keys
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 callers
Method
Time
Time returns a time.Time representation.
gjson.go:192
↓ 1 callers
Function
ValidBytes
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 callers
Method
Values
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 callers
Function
execModifier
execModifier parses the path to find a matching modifier function. The input expects that the path already starts with a '@'
gjson.go:2850
↓ 1 callers
Function
execStatic
execStatic parses the path to find a static value. The input expects that the path already starts with a '!'
gjson.go:2818
↓ 1 callers
Function
falseish
(t Result)
gjson.go:1367
↓ 1 callers
Function
getBytes
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 callers
Function
goJSONMarshal
(i interface{})
gjson_test.go:2552
↓ 1 callers
Function
isSimpleName
(component string)
gjson.go:2000
↓ 1 callers
Function
makeRandomJSONChars
(b []byte)
gjson_test.go:1103
↓ 1 callers
Function
nameOfLast
nameOfLast returns the name of the last component
gjson.go:1986
↓ 1 callers
Function
nullish
(t Result)
gjson.go:1403
↓ 1 callers
Function
parseArrayPath
(path string)
gjson.go:774
↓ 1 callers
Function
parseObjectPath
(path string)
gjson.go:982
↓ 1 callers
Function
parseRecursiveDescent
(all []Result, parent Result, path string)
gjson.go:3585
↓ 1 callers
Function
parseSubSelectors
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 callers
Function
queryMatches
(rp *arrayPathResult, value Result)
gjson.go:1407
↓ 1 callers
Function
trueish
(t Result)
gjson.go:1386
↓ 1 callers
Function
validarray
(data []byte, i int)
gjson.go:2591
↓ 1 callers
Function
validcolon
(data []byte, i int)
gjson.go:2563
↓ 1 callers
Function
validfalse
(data []byte, i int)
gjson.go:2728
↓ 1 callers
Function
validnull
(data []byte, i int)
gjson.go:2735
↓ 1 callers
Function
validnumber
(data []byte, i int)
gjson.go:2646
↓ 1 callers
Function
validobject
(data []byte, i int)
gjson.go:2521
↓ 1 callers
Function
validtrue
(data []byte, i int)
gjson.go:2721
Function
BenchmarkGoStdlibValidBytes
(b *testing.B)
gjson_test.go:1373
Function
BenchmarkValid
(b *testing.B)
gjson_test.go:1360
Function
BenchmarkValidBytes
(b *testing.B)
gjson_test.go:1366
next →
1–100 of 214, ranked by callers