Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

307
Vistas
Where to check Javascript's JSON.parse() error log on dev-tools?

I am new to Javascript trying to create a project that uses JSON.parse() function. My code runs successfully however JSON.parse dint work and didn't return any error on the dev tools console log.

I tried to debug my code with:

console.log("Test log1#######")
console.log(JSON.parse(json));
console.log("Test log2#######") 

On the console.log i can only see "Test log1#######". but not the "Test log2#######" which means code fails at line two but without printing any error on Devtools console as it does normally. But I am sure the code is failing due to some JSON validation issue but I can't see the. error anywhere on dev tools.

Please suggest a method to explore the error log of JSON.parse()

thanks

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

You can do :

try{
  JSON.parse(badFormat);
}catch(err){
  console.log(err);
}
about 4 years ago · Juan Pablo Isaza Denunciar

0

Most probably your "json" string is undefined

Try using the reviver parameter to see what is coming out of the json string. JSON.parse() spits out the error in the console tab of the browser if it finds the issue with the passed string

JSON.parse('your string', (key, value) => {
  console.log(key); // log the current property name, the last is "".
  return value;     // return the unchanged property value.
});

MDN JSON.parse

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda