How can I show JSON data in order to count the products without using the id?

0

I have this JSON data

{
 "data": [
{
  "0": "1",
  "1": "1",
  "2": "101",
  "3": "Aspiradora Industrial ",
  "4": "vistas/img/productos/101/105.png",
  "5": "13",
  "6": "1000",
  "7": "1200",
  "8": "2",
  "9": "2017-12-23 20:11:04",
  "id": "1",
  "id_categoria": "1",
  "codigo": "101",
  "descripcion": "Aspiradora Industrial ",
  "imagen": "vistas/img/productos/101/105.png",
  "stock": "13",
  "precio_compra": "1000",
  "precio_venta": "1200",
  "ventas": "2",
  "fecha": "2017-12-23 20:11:04"
},
{
  "0": "3",
  "1": "1",
  "2": "103",
  "3": "Compresor de Aire para pintura",
  "4": "vistas/img/productos/103/763.jpg",
  "5": "19",
  "6": "3000",
  "7": "4200",
  "8": "1",
  "9": "2017-12-23 20:11:04",
  "id": "3",
  "id_categoria": "1",
  "codigo": "103",
  "descripcion": "Compresor de Aire para pintura",
  "imagen": "vistas/img/productos/103/763.jpg",
  "stock": "19",
  "precio_compra": "3000",
  "precio_venta": "4200",
  "ventas": "1",
  "fecha": "2017-12-23 20:11:04"
}
 }
   ]

I want to show in my table the data but without using the id, because an element can be deleted. I have them in my javascript file

let table2 = $(".tabla-ventas").DataTable({

"ajax": "ajax/datatable.ventas.ajax.php",
"columns": [
    {"data": "0"},
    {"data": "imagen"},
    {"data": "codigo"},
    {"data": "descripcion"},
    {"data": "stock"},
    {"data": "id"}
],
    
asked by AndresGonzalez 01.05.2018 в 17:15
source

0 answers