metamodel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tomasz Guzialek (JIRA)" <>
Subject [jira] [Created] (METAMODEL-209) Replace Jackson with JSONPath in Neo4j module
Date Mon, 23 Nov 2015 18:13:11 GMT
Tomasz Guzialek created METAMODEL-209:

             Summary: Replace Jackson with JSONPath in Neo4j module
                 Key: METAMODEL-209
             Project: Apache MetaModel
          Issue Type: Improvement
            Reporter: Tomasz Guzialek
            Priority: Minor

In Neo4j module we are parsing JSON responses with Jackson that resulted in lots of boilerplate
code like this:

jsonResponseObject = new JSONObject(jsonResponse);
            JSONArray resultsJSONArray = jsonResponseObject.getJSONArray("results");
            JSONObject resultJSONObject = (JSONObject) resultsJSONArray.get(0);
            JSONArray dataJSONArray = resultJSONObject.getJSONArray("data");
            JSONObject rowJSONObject = (JSONObject) dataJSONArray.get(0);
            JSONArray valueJSONArray = rowJSONObject.getJSONArray("row");
            Number value = (Number) valueJSONArray.get(0);

Let's replace it with JSONPath query like: $.result[0].data[0].row

This message was sent by Atlassian JIRA

View raw message