I want to convert a JSON to a javascript object but it gives me this error:
Uncaught SyntaxError: Unexpected token or in JSON at position 1 at JSON.parse () at convertJsontoObjetoJS (Test_JSON-serializacion.js: 23) at onload (Text_html.html: 15)
I do not know why I get that, here's the code:
var JSONString2 = {"altura": 1.20, "edad": 5, "colorOjos": "cafe"};
var objetoJS = JSON.parse(JSONString2);
console.log(objetoJS);
for (i in objetoJS) {
document.write("Propiedad " + i + " : " + objetoJS[i] + "<br>");
}