Loop through JSON in EJS
JSON.stringify returns a String. So, for example: var data = [ { id: 1, name: “bob” }, { id: 2, name: “john” }, { id: 3, name: “jake” }, ]; JSON.stringify(data) will return the equivalent of: “[{\”id\”:1,\”name\”:\”bob\”},{\”id\”:2,\”name\”:\”john\”},{\”id\”:3,\”name\”:\”jake\”}]” as a String value. So when you have <% for(var i=0; i<JSON.stringify(data).length; i++) {%> what that ends up … Read more