Q:

Replace object value with values from an external array

I am working on a webchat that gets data of every message through a JSON protocol. Through ajax() I receive the following information:
{"id":"33","senderId":"1","message":"My fellow citizens","timestamp":"2014-10-24 11:45:04","conversationid":"2","status":"0"}

The senderId is the key to identify user's name, since if  senderId="1" it means that Michael sent the message. The array has the following names:
nameArray = ["Micheal", "Earvin", "Kareem", "Wilt", "Hakeem"]

I tried the following code, but it is not working.
senderId = JSON.parse(element.senderId)     
            for (var i=0; i<senderId.length; i++) {
                if (senderId[i] == 1) {
                    senderId[i] = nameArray[0];
                break;
                }
            }

Do you know how a way to change the senderId information according to the values of nameArray? 
Thanks in advance for your replies!

A:

Assuming element is the object {"id":"33","senderId":"1","message":"My fellow citizens","timestamp":"2014-10-24 11:45:04","conversationid":"2","status":"0"} and you want to replace senderId: 1 with Micheal, you can
element.senderId = nameArray[element.senderId - 1];

Demo

