README.md in jsonpath-0.4.1 vs README.md in jsonpath-0.4.2
- old
+ new
@@ -1,8 +1,8 @@
# Jsonpath
-This is an implementation of http://goessner.net/articles/JsonPath/.
+This is an implementation of http://goessner.net/articles/JsonPath/.
## Usage
There is stand-alone usage through the binary `jsonpath`
@@ -13,11 +13,11 @@
As well, you can include it as a library.
~~~~~ {ruby}
object = JSON.parse(<<-HERE_DOC)
- {"store":
+ {"store":
{"bicycle":
{"price":19.95, "color":"red"},
"book":[
{"price":8.95, "category":"reference", "title":"Sayings of the Century", "author":"Nigel Rees"},
{"price":12.99, "category":"fiction", "title":"Sword of Honour", "author":"Evelyn Waugh"},
@@ -28,13 +28,13 @@
}
HERE_DOC
JsonPath.new('$..price').on(object)
# => [19.95, 8.95, 12.99, 8.99, 22.99]
-
+
JsonPath.on(object, '$..author')
# => ["Nigel Rees", "Evelyn Waugh", "Herman Melville", "J. R. R. Tolkien"]
-
+
JsonPath.new('$..book[::2]').on(object)
# => [{"price"=>8.95, "category"=>"reference", "author"=>"Nigel Rees", "title"=>"Sayings of the Century"}, {"price"=>8.99, "category"=>"fiction", "author"=>"Herman Melville", "title"=>"Moby Dick", "isbn"=>"0-553-21311-3"}]
JsonPath.new('$..color').first(object)
# => "red"