I do not want to display double the same product. If isbn repeats then do not display it double.
{
"products": [{
"ident": "001",
"isbn": "2332",
"discount": "10%",
"bookstore": "library1"
}, {
"ident": "002",
"isbn": "2332",
"discount": "20%",
"bookstore": "library2"
}, {
"ident": "003",
"isbn": "3422",
"discount": "30%",
"bookstore": "library3"
}, ]
}
function getData() {
$.getJSON('data.json', function(data) { // get data from data.json
var products = data.products;
var tr = $("<tr>");
var items = '';
$.each(products, function(key, value) {
items += "<tr position=" + value.bookstore + ">";
items += "<td>" + value.ident + "</td>";
items += "<td>" + value.isbn + "</td>";
`enter code here`
items += "<td>" + value.discount + "</td>";
items += "<td>" + value.bookstore + "</td>";
items += "</tr>";
});
$('#data').append(items); // show data in table
});