JSON array javascript
JSon arrays are bounded by [] brackets
try
pets = '[{"name":"jack"},{"name":"john"},{"name":"joe"}]';
also you forgot to use "'s on the last property name.
A simpler JSON array (an array of strings):
["jack", "john", "joe"];
Putting it together as JavaScript:
var pets = '["jack", "john", "joe"]';
var arr = JSON.parse(pets);
console.log(arr[0]); // jack
console.log(arr[1]); // john
console.log(arr[2]); // joe
Your JSON is malformed. Try this:
var pets = '{"pets":[{"name":"jack"},{"name":"john"},{"name":"joe"}]}';
var arr = JSON.parse(pets);
alert(arr.pets[0].name);
yes just change it to this square brackets also check the double quotations on the last element
pets = '[{"name":"jack"},{"name":"john"},{"name":"joe"}]';
var arr = JSON.parse(pets);
alert(arr[0].name);