spark85 / json-path

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

JacksonTreeJsonProvider returns not a java.util.List #61

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. tried to use the JacksonTreeJsonProvider using Jackson (2.4.3) object (<<>>) 
with path "$..foo"
2. Used a code like this: jsonPath.read(jacksonObject, jsonPathConfiguration 
/*using JacksonTreeJsonProvider*/)
3. The result is an com.fasterxml.jackson.databind.node.ArrayNode, which do not 
implement the java.util.List interface (just the Iterable<JsonNode>).

What is the expected output? What do you see instead?
According to https://github.com/jayway/JsonPath#what-is-returned-when it should 
be a List for this input, although it is a 
com.fasterxml.jackson.databind.node.ArrayNode, so I get a ClassCastException.

What version of the product are you using? On what operating system?
1.1.1-SNAPSHOT (f8209fcc40693a012571614fe638ef1844c84f0b). Win7 64 bit, Java 7

Probably it is enough to change the documentation. With the 
com.jayway.jsonpath.spi.json.JsonProvider.toIterable(Object) we can convert the 
result to java.util.Iterable than to java.util.List.

Original issue reported on code.google.com by bakos.ga...@mind-era.com on 5 Nov 2014 at 12:21

GoogleCodeExporter commented 9 years ago
Updated docs:

"...Indefinite paths always returns a list (as represented by current 
JsonProvider)."

Original comment by kalle.st...@gmail.com on 10 Dec 2014 at 7:27