Merge pull request #155 from Prithvipal/master

Fixed syntax document for escape character
This commit is contained in:
Josh Baker 2020-02-22 11:09:40 -07:00 committed by GitHub
commit c041e47f8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -77,6 +77,14 @@ Special purpose characters, such as `.`, `*`, and `?` can be escaped with `\`.
fav\.movie "Deer Hunter" fav\.movie "Deer Hunter"
``` ```
You'll also need to make sure that the `\` character is correctly escaped when hardcoding a path in source code.
```go
res := gjson.Get(json, "fav\\.movie") // must escape the slash
res := gjson.Get(json, `fav\.movie`) // no need to escape the slash
```
### Arrays ### Arrays
The `#` character allows for digging into JSON Arrays. The `#` character allows for digging into JSON Arrays.