Class EscapeJsonFunction

java.lang.Object
org.citrusframework.functions.core.EscapeJsonFunction
All Implemented Interfaces:
org.citrusframework.functions.Function, org.citrusframework.functions.ParameterizedFunction<StringParameter>, StringFunction

public class EscapeJsonFunction extends Object implements StringFunction
This function takes a JSON string as input and escapes all double quotes within it.

The input must be a single non-empty string containing a valid JSON, wrapped in double quotes.

If the input is invalid (null, empty, or contains more than one string), an IllegalArgumentException will be thrown.

Example input: "{\"mySuperJson\": \"valium\"}"

Example output: "{\\\"mySuperJson\\\": \\\"valium\\\"}"

  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.citrusframework.functions.ParameterizedFunction

    org.citrusframework.functions.ParameterizedFunction.FunctionParameters
  • Field Summary

    Fields inherited from interface org.citrusframework.functions.Function

    functions, logger, RESOURCE_PATH
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    execute(String param, org.citrusframework.context.TestContext testContext)
    Execute function with the single String parameter.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.citrusframework.functions.ParameterizedFunction

    execute

    Methods inherited from interface org.citrusframework.functions.StringFunction

    execute
  • Constructor Details

    • EscapeJsonFunction

      public EscapeJsonFunction()
  • Method Details