I have JSON on AWS server that I access Using JQuery and inside that json file are a few hundred objects that I wish to loop through and pick out one at random. Then get the attributes for that object.

This is the JSON:

```
 {  
   "1":{  
      "title":"Sailing for Kids",
      "ISBN":"1909911267"
 },
   "2":{  
      "title":"True Spirit: The Aussie girl who took on the world",
      "ISBN":"413513243"
 },
..........

```

And this is how I am trying to get the json objects.

```
$(document).ready(function(){
$.ajax({
  crossOrigin: true,
  url : "https://link/to/file.json",
  type : "GET",
  success:function(data){
     var randomItem = data[Math.random() * data.length | 0];

      // take only the element with index 0
      alert(randomItem[0]);
  }
});
});

```

However, the alert is only displaying one character. like so:

[![enter image description here](https://i.stack.imgur.com/jgz1M.png)](https://i.stack.imgur.com/jgz1M.png)

How do I loop through all the returned JSON file the file, select one object and then get the attributes (title/ISBN) so that I can use them?