getjson - Why is this an invalid json? -
why invalid json, i'm tried putting quotes key , doesn't work.
{
nombre: “manzana”,
imagen: “./img/imagen_manzana.jpg”,
descripción: “manzana rica”,
preciokg: 24,
iva: 16,
inventario:30 }, {
nombre: “naranja”,
imagen: “./img/imagen_naranja.jpg”,
descripción: “naranja rica”,
preciokg: 14,
iva: 16,
inventario: 27 }
for several reasons:
the keys not in double quotes.
the strings quoted "fancy quotes" (
“
), not correct quotes"
.you have 2 top-level values. there can 1 top-level value. if want 2 objects, need wrap them in array.
http://jsonlint.com (no affiliation) , other such sites can these things.
minimal fix:
[ { "nombre": "manzana", "imagen": "./img/imagen_manzana.jpg", "descripción": "manzana rica", "preciokg": 24, "iva": 16, "inventario": 30 }, { "nombre": "naranja", "imagen": "./img/imagen_naranja.jpg", "descripción": "naranja rica", "preciokg": 14, "iva": 16, "inventario": 27 } ]
Comments
Post a Comment