README.md in jsonpath-1.0.3 vs README.md in jsonpath-1.0.4
- old
+ new
@@ -121,9 +121,54 @@
def test_and_operator_with_more_results
assert_equal [@object['store']['book'][1]], JsonPath.new("$..book[?(@['price'] < 23 && @['price'] > 9)]").on(@object)
end
```
+### Selecting Values
+
+It's possible to select results once a query has been defined after the query. For example given this JSON data:
+
+```bash
+{
+ "store": {
+ "book": [
+ {
+ "category": "reference",
+ "author": "Nigel Rees",
+ "title": "Sayings of the Century",
+ "price": 8.95
+ },
+ {
+ "category": "fiction",
+ "author": "Evelyn Waugh",
+ "title": "Sword of Honour",
+ "price": 12.99
+ }
+ ]
+}
+```
+
+... and this query:
+
+```ruby
+"$.store.book[*](category,author)"
+```
+
+... the result can be filtered as such:
+
+```bash
+[
+ {
+ "category" : "reference",
+ "author" : "Nigel Rees"
+ },
+ {
+ "category" : "fiction",
+ "author" : "Evelyn Waugh"
+ }
+]
+```
+
### Running an individual test
```ruby
ruby -Ilib:../lib test/test_jsonpath.rb --name test_wildcard_on_intermediary_element_v6
```