how to build a string of id's from a json object

Posted by Blankman on Stack Overflow See other posts from Stack Overflow or by Blankman
Published on 2010-05-12T15:00:52Z Indexed on 2010/05/12 15:04 UTC
Read the original article Hit count: 171

Filed under:
|

My json object looks like:

User { ID: 234, name: 'john', ..);

I want to build a string of all the ID's.

How can I do this? is there a more elegant way than below?

var ids = '';
for(int x = 0; x < json.length; x++)
{
      ids += json[x].Id + ",";
}
// strip trailing id

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about JSON