Use backtick for JSON node name, not quotes

This commit is contained in:
ccoVeille 2024-04-23 14:08:27 +02:00
parent c12548f200
commit 29588afd67
No known key found for this signature in database
2 changed files with 7 additions and 7 deletions

View File

@ -34,7 +34,7 @@ $ go get -u github.com/tidwall/gjson
This will retrieve the library.
## Get a value
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.
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.
```go
package main
@ -318,7 +318,7 @@ Suppose you want all the last names from the following JSON:
}
```
You would use the path "programmers.#.lastName" like such:
You would use the path `programmers.#.lastName` like such:
```go
result := gjson.Get(json, "programmers.#.lastName")

View File

@ -324,12 +324,12 @@ For example, using the given multi-path:
```
Here we selected the first name, age, and the first name for friends with the
last name "Murphy".
last name `Murphy`.
You'll notice that an optional key can be provided, in this case
"the_murphys", to force assign a key to a value. Otherwise, the name of the
actual field will be used, in this case "first". If a name cannot be
determined, then "_" is used.
`the_murphys`, to force assign a key to a value. Otherwise, the name of the
actual field will be used, in this case `first`. If a name cannot be
determined, then `_` is used.
This results in
@ -349,7 +349,7 @@ For example, using the given multi-path:
{name.first,age,"company":!"Happysoft","employed":!true}
```
Here we selected the first name and age. Then add two new fields, "company" and "employed".
Here we selected the first name and age. Then add two new fields, `company` and `employed`.
This results in