I am running an ajax query and returning JSON and one of the results is a field named `image.comment` e.g.

```
test~63~Dave Sanders~http://graph.facebook.com/998433599/picture?type=large~Dave Sanders~9 minutes ago

```

I'm using `~` as a separator

There maybe be multiple similar sets of data separated by `----` in `image.comment` so to parse the data and add it to the DOM i'm using:

```
if(image.comment){

        html += '<div class="msgs_holder'+image.list_id+'">';

        // split comment at ----        
        var comString = image.comment;
        var comArray = comString.split("----");

        var lengthArray = comArray.length,
        element = null;

        for (var i = 0; i < lengthArray; i++) {
            element = comArray[i];

            // split indiv comment at ~     
            var comUserString = element;
            var comUserArray = comUserString.split("~");

            html += '<div class="msgs_row"><div class="msgs_pic"><a href="/'+comUserArray[4]+'"><img src="'+comUserArray[3]+'"></a></div>';
            html += '<div class="msgs_comment"><a href="/'+comUserArray[4]+'" style="text-decoration:none;"><span class="msgs_name">'+comUserArray[2]+'</span></a> '+comUserArray[0]+'<br><span class="msgs_time" title="'+comUserArray[5]+'">'+comUserArray[5]+'</span></div></div>';

        }

        html += '</div>';

    }

```

But the page fails to load and firefox firebug tells me: `allocation size overflow`

This only happens on rows of the JSON where there is data in `comment` column

I suspect some maybe infinite looping but can't see it

I've checked the query and it runs fine so not that

Is this the best way to explode in js?

Any ideas?

**MORE INFO** The reason I'm doing it this way is it's a piece of a much bigger query. Images loaded to a page with comments under each image. So I'm loading the comments into a column to be parsed for display.

Example:

```
Image 1        Image 2        Image 3                       etc etc etc
hey                           i think its great!
hey back!                     me too
                              I'm not sure

```

**MORE INFO 2** This data is taken from a MySQL query e.g

```
select w.img_width, w.img_height, w.prod_pic_url as preview3,
        GROUP_CONCAT(ww.comment,'~', h.user_id,'~', h.name,'~', 
        h.live_prof_pic,'~', h.twovo_url,'~', time_ago(ww.dateadded) SEPARATOR '----') AS comment 
        from tableName where blah=blah

```

GROUP\_CONCAT is the comments section mentioned above

So, to use JSON for data within data, is that possible? If so how?

Example returned data:

```
"preview3":"http:\/\/myurl.com\/wish_images\/production\/3578.jpg","comment":"test~63~Dave Sanders~http:\/\/graph.facebook.com\/Dave Sanders\/picture?type=large~Dave Sanders~39 minutes ago"},{"item_id":"3559","numComms":"0","numLikes":"0"... etc etc

```