additional example

This commit is contained in:
Josh Baker 2016-08-21 09:56:42 -07:00 committed by GitHub
parent d498de1770
commit 360ac81635
1 changed files with 8 additions and 6 deletions

View File

@ -48,11 +48,14 @@ This will print:
Prichard
```
## Path Syntax
A path is a series of keys separated by a dot.
A key may contain special wildcard characters '\*' and '?'.
To access an array value use the index as the key.
To get the number of elements in an array or to access a child path, use the '#' character.
The dot and wildcard characters can be escaped with '\'.
```
{
"name": {"first": "Tom", "last": "Anderson"},
@ -64,6 +67,7 @@ The dot and wildcard characters can be escaped with '\'.
{"first": "Roger", "last": "Craig"}
]
}
"name.last" >> "Anderson"
"age" >> 37
"children.#" >> 3
@ -72,11 +76,9 @@ The dot and wildcard characters can be escaped with '\'.
"c?ildren.0" >> "Sara"
"fav\.movie" >> "Deer Hunter"
"friends.#.first" >> [ "James", "Roger" ]
"friends.1.last" >> "Craig"
```
## Result Type
GJSON supports the json types `string`, `number`, `bool`, and `null`.