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:

  1. the keys not in double quotes.

  2. the strings quoted "fancy quotes" (), not correct quotes ".

  3. 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

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -