RuddenberryL / json-path

Automatically exported from code.google.com/p/json-path
0 stars 0 forks source link

Filters with dot notations doesn't work #33

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Applying the following JSON Path '$.store.book[?(@.author.age == 36)]' on the 
following JSON:
{ "store": {
    "book": [ 
      { "category": "reference",
        "author": {
          "name": "Author Name",
          "age": 36
        },
        "title": "Sayings of the Century",
        "price": 8.95
      },
      { "category": "fiction",
        "author": "Evelyn Waugh",
        "title": "Sword of Honour",
        "price": 12.99,
        "isbn": "0-553-21311-3"
      }
    ],
    "bicycle": {
      "color": "red",
      "price": 19.95
    }
  }
}

What is the expected output? What do you see instead?
Expected output: 
     { "category": "reference",
        "author": {
          "name": "Author Name",
          "age": 36
        }
        "title": "Sayings of the Century",
        "price": 8.95
      }

Actual output:
[]

What version of the product are you using? On what operating system?
json-path version: Released 0.8.1
operating system: Windows 7

Please provide any additional information below.
It seems that if I provide a filter with dot notation e.g. '?(@.author.age == 
36)', the filter doesn't work. Filters like '?(@.category == 'reference')' 
works correctly.

JsonPath.read(new File("json.txt"), "$.store.book[?(@.author.age == 36)]")) - []

JsonPath.read(new File("json.txt"), "$.store.book[?(@.category == 
'reference')]")) - [{"author":{"age":36,"name":"Author Name"},"title":"Sayings 
of the Century","category":"reference","price":8.95}]

Original issue reported on code.google.com by dgyorda...@gmail.com on 4 Jun 2013 at 7:15

GoogleCodeExporter commented 9 years ago
Did you have any luck figuring out how to do this?

Cheers.

Original comment by paul.c....@gmail.com on 3 Jul 2013 at 10:54

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
This is supported in version 0.9.0, soon to be released.

Original comment by kalle.st...@gmail.com on 22 Aug 2013 at 8:34

GoogleCodeExporter commented 9 years ago

Original comment by kalle.st...@gmail.com on 22 Aug 2013 at 8:35