forked from mirror/gjson
Update SYNTAX.md
This commit is contained in:
parent
d6cb589fc4
commit
e78ccfebe4
15
SYNTAX.md
15
SYNTAX.md
|
@ -77,14 +77,21 @@ 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.
|
You'll also need to make sure that the `\` character is correctly escaped when hardcoding a path in you source code.
|
||||||
|
|
||||||
```go
|
```go
|
||||||
res := gjson.Get(json, "fav\\.movie") // must escape the slash
|
// Go
|
||||||
res := gjson.Get(json, `fav\.movie`) // no need to escape the slash
|
val := gjson.Get(json, "fav\\.movie") // must escape the slash
|
||||||
|
val := gjson.Get(json, `fav\.movie`) // no need to escape the slash
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```rust
|
||||||
|
// Rust
|
||||||
|
let val = gjson::get(json, "fav\\.movie") // must escape the slash
|
||||||
|
let val = gjson::get(json, r#"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.
|
||||||
|
|
Loading…
Reference in New Issue