bbenet / json-path

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

Query for property directly on an array should throw InvalidPathException instead of returning null #34

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Given some json:
{
  "key": [
    1, 2, 3
  ]
}
When I query for 'key.invalid'
Then I get 'null' - a valid json value

Current behavior is to return 'null' in this case. Looking at Issue 7 it 
appears this was intentional.

However, it is confusing because 'null' is a valid json value... So it looks 
like the key has a field 'invalid', and the value was 'null', when actually no 
such field exists.

I would expect an InvalidPathException, which is what is thrown elsewhere when 
queries are made for fields that do not exist.

What version of the product are you using? On what operating system?
master (5993e05b73c6fc1a4ad92048e2fd37edea38cf01) on Java 1.6 (OSX)

Will add pull request shortly.

Jack Singleton

Original issue reported on code.google.com by jack.s.s...@gmail.com on 10 Jul 2013 at 7:06

GoogleCodeExporter commented 8 years ago
https://github.com/jayway/JsonPath/pull/27

Original comment by jack.s.s...@gmail.com on 10 Jul 2013 at 8:40

GoogleCodeExporter commented 8 years ago
Merged and will be part of next release.

Original comment by kalle.st...@gmail.com on 19 Aug 2013 at 1:53