This function returns p_string with all special characters escaped.
Syntax
APEX_ESCAPE.JSON (
    p_string  IN VARCHAR2 )
RETURN VARCHAR2;
Parameters
Table 9-7 JSON Function Parameters
| Parameter | Description | 
|---|---|
| 
 
  | 
 The string to be escaped.  | 
Returns/Raised Errors
Table 9-8 JSON Function Returns
| Return | Description | 
|---|---|
| 
 
  | 
 The escaped string.  | 
Example
The following example prints this: { "name": "O\u0027Brien"}
declare
    l_string varchar2(4000) := 'O''Brien';
begin
    sys.htp.p('{ "name": "'||apex_escape.json(l_string)||'"}');
end;