Open aabeling opened 6 years ago
Got same problem:
JsonPath.using(Configuration.defaultConfiguration().jsonProvider(new JacksonJsonNodeJsonProvider())).parse("[{\"f1\": [1,2,3]}, {\"f1\": [4,5,6,3,2]}]").read("$[1].f1[?(@ in $[0].f1)]");
Causes error:
java.lang.ClassCastException: com.fasterxml.jackson.databind.node.ArrayNode cannot be cast to java.util.List
at com.jayway.jsonpath.internal.filter.ValueNode$JsonNode.asValueListNode(ValueNode.java:341)
at com.jayway.jsonpath.internal.filter.EvaluatorFactory$InEvaluator.evaluate(EvaluatorFactory.java:173)
at com.jayway.jsonpath.internal.filter.RelationalExpressionNode.apply(RelationalExpressionNode.java:44)
at com.jayway.jsonpath.internal.filter.FilterCompiler$CompiledFilter.apply(FilterCompiler.java:415)
at com.jayway.jsonpath.internal.path.PredicatePathToken.accept(PredicatePathToken.java:76)
at com.jayway.jsonpath.internal.path.PredicatePathToken.evaluate(PredicatePathToken.java:59)
at com.jayway.jsonpath.internal.path.PathToken.handleObjectProperty(PathToken.java:81)
at com.jayway.jsonpath.internal.path.PropertyPathToken.evaluate(PropertyPathToken.java:79)
at com.jayway.jsonpath.internal.path.PathToken.handleArrayIndex(PathToken.java:134)
at com.jayway.jsonpath.internal.path.ArrayPathToken.evaluateIndexOperation(ArrayPathToken.java:63)
at com.jayway.jsonpath.internal.path.ArrayPathToken.evaluate(ArrayPathToken.java:52)
at com.jayway.jsonpath.internal.path.RootPathToken.evaluate(RootPathToken.java:62)
at com.jayway.jsonpath.internal.path.CompiledPath.evaluate(CompiledPath.java:53)
at com.jayway.jsonpath.internal.path.CompiledPath.evaluate(CompiledPath.java:61)
at com.jayway.jsonpath.JsonPath.read(JsonPath.java:187)
at com.jayway.jsonpath.internal.JsonContext.read(JsonContext.java:102)
at com.jayway.jsonpath.internal.JsonContext.read(JsonContext.java:89)
at org.dmwm.test.jxpath.JsonPathTest.test_06_0_jackson_bug(JsonPathTest.java:111)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
I have the same problem. Configurations with either JacksonJsonProvider or JacksonJsonNodeJsonProvider will throw this exception if the 'in' operator is used.
Hello! Any progress on this?
Same problem. I'm using JacksonJsonNodeJsonProvider.
Hi,
I am using json-path-2.4.0.
My document is the following
And the code is
It fails with
Any help is appreciated.
Best regards Achim