From 29588afd67568cc4e005dd9a03654099f6bac37c Mon Sep 17 00:00:00 2001 From: ccoVeille <3875889+ccoVeille@users.noreply.github.com> Date: Tue, 23 Apr 2024 14:08:27 +0200 Subject: [PATCH] Use backtick for JSON node name, not quotes --- README.md | 4 ++-- SYNTAX.md | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 73a60e6..4807517 100644 --- a/README.md +++ b/README.md @@ -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") diff --git a/SYNTAX.md b/SYNTAX.md index b4cd1b2..39b77d4 100644 --- a/SYNTAX.md +++ b/SYNTAX.md @@ -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