The Rest procedure the way you designed above, takes the XML output you generated and converts that to JSON automatically. It is not smart enough to figure out the differences in the data type representation. My suggestion would be, if you do not care about XML output, rewrite the same procedure using JSON based functions instead of XML functions and return the JSON payload the way you need. But if you do that convert the "xml_out:XMLLiteral" to clob.
Thanks for quick response Ramesh...