Convert endpoint response

Ok, I have everything installed and am now loaded up with coffee getting my arms around the features. I’m not familiar with the workflow yet, and have what I hope is a simple question with maybe a nudge in the right direction.

I am setting up an endpoint where the response is a single line, plain text set of values separated by commas.

for example

uh2Dx0cAHmXWerGV,1,DENIED 999,100,VISA,202,2000,nL9ZUekjV6SxrDXIhQ3pnbBZg2A5uga6GCc

What I want to do is transform this into JSON with the appropriate keys that represent the values separated by the commas. In this example, the transformed JSON from the response should look like this:

{
  "hostId" : "uh2Dx0cAHmXWerGV",
  "hostResponseCode": 1,
  "hostResponseMessage": "DENIED 999",
  "hostApprovalCode" : 100,
  "hostCardType" : "VISA",
  "hostCardResponseAvsCode" : 202,
  "hostCvResponseCode" : 2000,
  "hostCardToken" : "nL9ZUekjV6SxrDXIhQ3pnbBZg2A5uga6GCc"
}

Is this best done using a Transform, URL Rewrite or Virtual Endpoint? I’m at a loss, will be trying to figure it out but if anyone has a good grasp on this (and can give me a kickstart) I would sure appreciate it!

You’ll need to use a virtual endpoint, the transforms only work with JSON at the moment (XML and form data soon). I’ll warn you now it won’t be very efficient :-/