In addition to the suggestions Ravi gave, I might ask why you're taking this approach to begin with. What is the business problem you are trying to solve with this function? Is there a guardrails compliant way to do what you are trying to do? Usually the answer is yes and then you can leverage all of the tools and power of the Pega 7 platform.
This is to parse a json response from an authenticated REST service which is not OOTB for Pega as Pega supports only 3 types of authentication but Janus authentication is not ootb. We're using that to get JSON and to parse json we need the HashMap.