Search in sources :

Example 1 with JsonOrgMappingProvider

use of com.jayway.jsonpath.spi.mapper.JsonOrgMappingProvider in project phoenix by apache.

the class JsonEventSerializer method getPatternData.

private String getPatternData(JSONObject json, String pattern) {
    Configuration JSON_ORG_CONFIGURATION = Configuration.builder().mappingProvider(new JsonOrgMappingProvider()).jsonProvider(new JsonOrgJsonProvider()).build();
    String value;
    try {
        Object object = JsonPath.using(JSON_ORG_CONFIGURATION).parse(json).read(pattern);
        value = object.toString();
    } catch (Exception e) {
        value = null;
    }
    return value;
}
Also used : JsonOrgMappingProvider(com.jayway.jsonpath.spi.mapper.JsonOrgMappingProvider) Configuration(com.jayway.jsonpath.Configuration) JsonOrgJsonProvider(com.jayway.jsonpath.spi.json.JsonOrgJsonProvider) JSONObject(org.json.JSONObject) SQLException(java.sql.SQLException) JSONException(org.json.JSONException)

Aggregations

Configuration (com.jayway.jsonpath.Configuration)1 JsonOrgJsonProvider (com.jayway.jsonpath.spi.json.JsonOrgJsonProvider)1 JsonOrgMappingProvider (com.jayway.jsonpath.spi.mapper.JsonOrgMappingProvider)1 SQLException (java.sql.SQLException)1 JSONException (org.json.JSONException)1 JSONObject (org.json.JSONObject)1