Your response in res.text
is probably a string.
When you stringify
a string the quotes become escaped, resulting in this;
""[{\"userId\":\"macario\",\"cash\":1000,\"createdAt\":\"2014-03-
04T20:17:57.483Z\",\"updatedAt\":\"2014-03-07T02:47:51.098Z\",\"id\":15}]""
So when you call JSON.parse
on it, it just turns it back into a String, instead of into the Object you want.
Just change this line;
var result = JSON.parse(JSON.stringify(res.text));
to this;
var result = JSON.parse(res.text);
If the parse
fails then the JSON in res.text
is malformed and that is your main problem.