deve_thomos
asked on
How to make a generic function for json data in oracle ?
Hi expert,
on below query i am handling json. actually exactly i dont know which special character handled by json and which one is not handled by json. so when i was entering data to this particular field , i have observed that these many characters are not supported by json , so i replaced this character like below. but exactly i donot know which is supported by json and which is not supported json. so i want a generic function , by which all special characters can handle by json.
for above things is working fine but problem is i dont know how many specail charecters are there like this which is not handle by json. so i want to make a generic function with all special characters which can handle by JSON.
Regards
Thomos
on below query i am handling json. actually exactly i dont know which special character handled by json and which one is not handled by json. so when i was entering data to this particular field , i have observed that these many characters are not supported by json , so i replaced this character like below. but exactly i donot know which is supported by json and which is not supported json. so i want a generic function , by which all special characters can handle by json.
replace(replace(replace(emp_name,'\' , '\\\\' ),'''' , '\''' ),'"' , '\\"' ) ;
for above things is working fine but problem is i dont know how many specail charecters are there like this which is not handle by json. so i want to make a generic function with all special characters which can handle by JSON.
Regards
Thomos
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
below is my code
I have handle for above json charecters but i am not getting idea how to handle hexadecimal digits(/U).
Regards
Thomos
I have handle for above json charecters but i am not getting idea how to handle hexadecimal digits(/U).
function rep(p_column_id varchar2) return varchar2 as
begin
return replace(replace(replace(replace(replace(replace(replace(p_column_id, '\', '\\'), '"','\"'),
CHR(9),'\t'),CHR(8),'\b'),CHR(13),'\r'),CHR(12),'\f'),CHR(10),'\n');
end rep;
Regards
Thomos
I don't know a lot about JSON.
I can help with the regular expression once I understand the patterns.
What do they look like in JSON?
I can help with the regular expression once I understand the patterns.
What do they look like in JSON?
ASKER
THANKS A LOT
I am not 100% sure but this escape the URL 's but still can be used on any varchar2(4000) characters.