37.34 TO_MEMBER_NAME Function

This function converts the given string to a JSON member name, usable for accessing values via the get_% functions. Unless member names are simple identifiers (A-Z,0-9, "_"), they need to be quoted.

Syntax

FUNCTION TO_MEMBER_NAME (
   p_string IN VARCHAR2 )
   RETURN VARCHAR2;

Parameters

Parameter Description
p_string The raw member name.

Returns

A valid member name for get_% functions.

Example

Print various converted strings.

BEGIN
    sys.dbms_output.put_line('Unquoted: '||apex_json.to_member_name('member_name'));
    sys.dbms_output.put_line('Quoted:   '||apex_json.to_member_name('Hello"World'));
END;

Output:

    Unquoted: member_name
    Quoted:   "Hello\"World"