Skip to content

Commit

Permalink
Use backtick for JSON node name, not quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
ccoVeille committed Apr 23, 2024
1 parent 058915e commit cc9e819
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand Down
10 changes: 5 additions & 5 deletions SYNTAX.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down

0 comments on commit cc9e819

Please sign in to comment.