Class JsonUtil

java.lang.Object
org.frankframework.json.JsonUtil

public class JsonUtil extends Object
  • 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 a JsonPath from the jsonPathExpression parameter, if it's not null. If jsonPathExpression is null, return null.
      Parameters:
      jsonPathExpression - JSON Path Expression to compile. May be null.
      Returns:
      JsonPath compiled from the jsonPathExpression, or null if jsonPathExpression was null.
      Throws:
      ConfigurationException - If there was any exception in trying to compile the jsonPathExpression, throw a ConfigurationException.
    • evaluateJsonPathToSingleValue

      @Nullable public static String evaluateJsonPathToSingleValue(@Nonnull com.jayway.jsonpath.JsonPath jsonPath, Message message) throws JsonException
      Evaluate given JsonPath against the input Message and return a single scalar value, represented as String.
      • 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 null is returned to indicate that there was no result.
      Parameters:
      jsonPath - JsonPath expression to evaluate
      message - Message from 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 null if there was no result.
      Throws:
      JsonException - If an exception occurred evaluating the expression a JsonException is thrown.
    • evaluateJsonPath

      @Nonnull public static String evaluateJsonPath(@Nonnull com.jayway.jsonpath.JsonPath jsonPath, @Nonnull Object input) throws JsonException
      Throws:
      JsonException
    • jsonPretty

      public static String jsonPretty(String json)