Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
* $javascript -> He didn't say, "Stop!"
* $esc.javascript($javascript) -> He didn\'t say, \"Stop!\"
*
* $json -> He didn't say, "Stop!"
* $esc.json($json) -> He didn't say, \"Stop!\"
*
* $html -> "bread" & "butter"
* $esc.html($html) -> "bread" & "butter"
*
Expand Down Expand Up @@ -301,6 +304,18 @@ public String javascript(Object string)
return StringEscapeUtils.escapeEcmaScript(String.valueOf(string));
}

/**
* <p>Escapes the characters in a <code>String</code> using JSON String rules.</p>
* <p>Delegates the process to {@link #java(String)}.</p>
*
* @param string the string to escape values, may be null
* @return String with escaped values, <code>null</code> if null string input
*/
public String json(Object string)
{
return java(string);
}

/**
* <p>Escapes the characters in a <code>String</code> using HTML entities.</p>
* <p>Delegates the process to {@link StringEscapeUtils#escapeHtml4(String)}.</p>
Expand Down