From 360ac81635184526bf5bf6c5ef45b186a8030ad5 Mon Sep 17 00:00:00 2001 From: Josh Baker Date: Sun, 21 Aug 2016 09:56:42 -0700 Subject: [PATCH] additional example --- README.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 0b15e33..6686338 100644 --- a/README.md +++ b/README.md @@ -48,11 +48,14 @@ This will print: Prichard ``` -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. +## 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`.