i get this JSON from my REST:
{"users":[{"id_user":"1","firstname":"Admin","lastname":"Admin","mail":"[email protected]","password":"admin"}]} and with follow code i want to parse the JSON response.
$.getJSON("http://localhost/REST/users", function(data) { var jsonData = JSON.parse(data); for (var i = 0; i < jsonData.counters.length; i++) { var counter = jsonData.counters[i]; console.log(counter.counter_name); } }); but in the console i get this error message:
SyntaxError: JSON.parse: unexpected character at line 1 column 2 of the JSON data I hope you can help me =/