0

This JsonPath

$.accounts[?('abc' in @.contact_ids)].user_id

gives in error when run in java:

com.jayway.jsonpath.InvalidPathException: java.lang.UnsupportedOperationException: CriteriaType can not be parsed

but works perfect on https://jsonpath.herokuapp.com/ using jayway implementation.

Exception trace:

at com.jayway.jsonpath.internal.PathCompiler.compile(PathCompiler.java:157)
at com.jayway.jsonpath.JsonPath.<init>(JsonPath.java:99)
at com.jayway.jsonpath.JsonPath.compile(JsonPath.java:426)
at com.jayway.jsonpath.internal.JsonReader.read(JsonReader.java:135)
Caused by: java.lang.UnsupportedOperationException: CriteriaType  can not be parsed
    at com.jayway.jsonpath.Criteria$CriteriaType.parse(Criteria.java:333)
    at com.jayway.jsonpath.Criteria.create(Criteria.java:807)
    at com.jayway.jsonpath.Criteria.parse(Criteria.java:755)
    at com.jayway.jsonpath.Filter.parse(Filter.java:175)
    at com.jayway.jsonpath.internal.PathCompiler$PathComponentAnalyzer.analyzeCriteriaSequence4(PathCompiler.java:284)
    at com.jayway.jsonpath.internal.PathCompiler$PathComponentAnalyzer.analyze(PathCompiler.java:262)
    at com.jayway.jsonpath.internal.PathCompiler$PathComponentAnalyzer.analyze(PathCompiler.java:236)
    at com.jayway.jsonpath.internal.PathCompiler.compile(PathCompiler.java:145)
    ... 37 more

Sample json is like this, though the error is not related to the json:

{
  "accounts": [
    {
      "user_id": "mail1@hotmail.com",
      "contact_ids": [
        "101",
        "102",
        "103",
        "104",
        "114",
        "115",
        "123"
      ]
    },
    {
      "user_id": "mail2@hotmail.com",
      "contact_ids": [
        "135",
        "156",
        "159"
      ]
    }]}
user3419148
  • 111
  • 1
  • 8

1 Answers1

-1

Plz ignore. I had a dangling dependency on version 2.0 in my project.

user3419148
  • 111
  • 1
  • 8