Package org.frankframework.json
Class JsonUtil
java.lang.Object
org.frankframework.json.JsonUtil
-
Method Summary
Modifier and TypeMethodDescriptionstatic JsonMapperbuildJsonMapper(IScopeProvider scopeProvider, String stylesheetName, DataSonnetOutputType outputType, boolean computeMimeType, ParameterList parameters) static com.jayway.jsonpath.JsonPathcompileJsonPath(String jsonPathExpression) Compile aJsonPathfrom thejsonPathExpressionparameter, if it's notnull.static StringevaluateJsonPath(com.jayway.jsonpath.JsonPath jsonPath, Object input) static StringevaluateJsonPathToSingleValue(com.jayway.jsonpath.JsonPath jsonPath, Message message) static StringjsonPretty(String json)
-
Method Details
-
buildJsonMapper
public static JsonMapper buildJsonMapper(IScopeProvider scopeProvider, String stylesheetName, DataSonnetOutputType outputType, boolean computeMimeType, ParameterList parameters) throws ConfigurationException - Throws:
ConfigurationException
-
compileJsonPath
@Nullable public static com.jayway.jsonpath.JsonPath compileJsonPath(@Nullable String jsonPathExpression) throws ConfigurationException Compile aJsonPathfrom thejsonPathExpressionparameter, if it's notnull. IfjsonPathExpressionisnull, returnnull.- Parameters:
jsonPathExpression- JSON Path Expression to compile. May benull.- Returns:
JsonPathcompiled from thejsonPathExpression, ornullifjsonPathExpressionwasnull.- Throws:
ConfigurationException- If there was any exception in trying to compile thejsonPathExpression, throw aConfigurationException.
-
evaluateJsonPathToSingleValue
@Nullable public static String evaluateJsonPathToSingleValue(@Nonnull com.jayway.jsonpath.JsonPath jsonPath, Message message) throws JsonException Evaluate givenJsonPathagainst the inputMessageand return a single scalar value, represented asString.
- If the expression evaluation results in a JsonArray, the first value of the array is returned.
- If the expression evaluation results in a JsonObject, an empty string is returned to indicate a non-scalar value was found.
- If the expression evaluation does not result in any value found, then
nullis returned to indicate that there was no result.
- Parameters:
jsonPath-JsonPathexpression to evaluatemessage-Messagefrom which to extract data- Returns:
- Single scalar value from the message, an empty string if the value could not be reduced to a scalar, or
nullif there was no result. - Throws:
JsonException- If an exception occurred evaluating the expression aJsonExceptionis thrown.
-
evaluateJsonPath
@Nonnull public static String evaluateJsonPath(@Nonnull com.jayway.jsonpath.JsonPath jsonPath, @Nonnull Object input) throws JsonException - Throws:
JsonException
-
jsonPretty
-