Instead of just using the Restv2 resource and invoking the API using the /restv2 directive. Create a Rest API Descriptor and define the signature of the API output as per your requirement. You wouldn’t need to do any additional processing for it. And once you create the Rest API Descriptor, invoke your REST API using the /rad directive.