Class JsonHelper
- java.lang.Object
-
- com.smartgridready.communicator.common.helper.JsonHelper
-
public class JsonHelper extends java.lang.ObjectProvides helper methods for JSON.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ValuemapJsonResponse(com.smartgridready.ns.v0.JMESPathMapping jmesPathMapping, java.lang.String response)Evaluates a JMESPath mapping on a JSON string and returns as SGr value.static ValueparseJsonResponse(java.lang.String jmesPath, java.lang.String jsonResp)Evaluates a JMESPath expression on a JSON string and returns as SGr value.static ValueparseJsonResponseWithJsonata(java.lang.String jsonataExpression, java.lang.String jsonResp)Evaluates a JSONata expression on a JSON string and returns as SGr value.
-
-
-
Method Detail
-
parseJsonResponse
public static Value parseJsonResponse(java.lang.String jmesPath, java.lang.String jsonResp) throws com.smartgridready.driver.api.common.GenDriverException
Evaluates a JMESPath expression on a JSON string and returns as SGr value.- Parameters:
jmesPath- the JMESPath expressionjsonResp- the JSON string- Returns:
- an instance of
JsonValue - Throws:
com.smartgridready.driver.api.common.GenDriverException- when an error occurred during parsing
-
parseJsonResponseWithJsonata
public static Value parseJsonResponseWithJsonata(java.lang.String jsonataExpression, java.lang.String jsonResp) throws com.smartgridready.driver.api.common.GenDriverException
Evaluates a JSONata expression on a JSON string and returns as SGr value.- Parameters:
jsonataExpression- the JSONata expressionjsonResp- the JSON string- Returns:
- an instance of
JsonValue - Throws:
com.smartgridready.driver.api.common.GenDriverException- when an error occurred during parsing
-
mapJsonResponse
public static Value mapJsonResponse(com.smartgridready.ns.v0.JMESPathMapping jmesPathMapping, java.lang.String response) throws com.smartgridready.driver.api.common.GenDriverException
Evaluates a JMESPath mapping on a JSON string and returns as SGr value.- Parameters:
jmesPathMapping- the JMESPath mappingresponse- the JSON string- Returns:
- an instance of
JsonValue - Throws:
com.smartgridready.driver.api.common.GenDriverException- when an error occurred during parsing and mapping
-
-