JsonPath NoClassDefFoundError, ou une alternative à JsonPath en Java

Pour des raisons liées au projet sur lequel je travaille, j'aimerais une requête pour un fichier JSON, comme une chaîne, par exemple, $.store.book[*].title (plutôt que d'avoir à stocker chaque niveau du document temporairement comme un objet distinct).

Je suis actuellement à l'aide JsonPath (version 0.8.0, qui a été la dernière que j'ai pu trouver), qui est en fait exactement ce que je cherche, mais je suis de l'exception ci-dessous. Je suis juste en utilisant l'exemple de JSON donné sur le JsonPath page google code, à l'aide de l'un de leurs exemples de requêtes.

Ce que je fais mal? Sinon, si il n'y a pas une solution, il y a des alternatives à JsonPath en Java? Je veux être en mesure de passer toute une requête comme une chaîne de caractères, et il doit être en Java.

La fonction:

public void testJsonPath() throws Exception
{
    String query = "$.store.book[*].title";
    List toRet = (List) JsonPath.read(practiceJson, query, new Filter[0]);
    System.out.println(toRet.toString());
}

L'exception:

java.lang.NoClassDefFoundError: net/minidev/json/parser/ParseException
at com.jayway.jsonpath.spi.JsonProviderFactory$1.create(JsonProviderFactory.java:27)
at com.jayway.jsonpath.spi.JsonProviderFactory.createProvider(JsonProviderFactory.java:32)
at com.jayway.jsonpath.JsonPath.read(JsonPath.java:202)
at com.jayway.jsonpath.JsonPath.read(JsonPath.java:307)
at net.windward.datasource.test.TestJsonDataSource.testJsonPath(TestJsonDataSource.java:119)

La pratique JSON:

private String practiceJson = "{\n" +
        "    \"store\": {\n" +
        "        \"book\": [ {\n" +
        "            \"category\": \"reference\",\n" +
        "            \"author\": \"Nigel Rees\",\n" +
        "            \"title\": \"Sayings of the Century\",\n" +
        "            \"price\": 8.95\n" +
        "        }, {\n" +
        "            \"category\": \"fiction\",\n" +
        "            \"author\": \"Evelyn Waugh\",\n" +
        "            \"title\": \"Sword of Honour\",\n" +
        "            \"price\": 12.99\n" +
        "        }, {\n" +
        "            \"category\": \"fiction\",\n" +
        "            \"author\": \"Herman Melville\",\n" +
        "            \"title\": \"Moby Dick\",\n" +
        "            \"isbn\": \"0-553-21311-3\",\n" +
        "            \"price\": 8.99\n" +
        "        }, {\n" +
        "            \"category\": \"fiction\",\n" +
        "            \"author\": \"J. R. R. Tolkien\",\n" +
        "            \"title\": \"The Lord of the Rings\",\n" +
        "            \"isbn\": \"0-395-19395-8\",\n" +
        "            \"price\": 22.99\n" +
        "        } ],\n" +
        "        \"bicycle\": [ {\n" +
        "            \"color\": \"red\",\n" +
        "            \"price\": 19.95,\n" +
        "            \"style\": [ \"city\", \"hybrid\" ]\n" +
        "        }, {\n" +
        "            \"color\": \"blue\",\n" +
        "            \"price\": 59.91,\n" +
        "            \"style\": [ \"downhill\", \"freeride\" ]\n" +
        "        } ]\n" +
        "    }\n" +
        "}";

OriginalL'auteur firechant | 2013-07-18