Kina, check this line of code you posted compared to your actual line of code:
jsonPayload = "{\"data\":\"" + restArray + "\"}";
Is anything missing? I think it probably is. This is exactly why you should post code using code tags, according to the guidelines in the forum sticky post.