Class EscapeJsonFunction

java.lang.Object
org.citrusframework.functions.core.EscapeJsonFunction
All Implemented Interfaces:
Function

public class EscapeJsonFunction extends Object implements Function
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\\\"}"