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

194
Vistas
How do I get a JSON file to show sub-arrays?

I know it's a simple question, but I've tried multiple ways and I can't get it to work. I have a huge JSON file (that I use a reduced version of) which I finally managed to let my script retrieve the file using the require(); function:

let wordBank = './Wordbank.json';

function getData() {
  console.log(require(wordBank));
}
getData();

The terminal displays the few lines of my reduced JSON file like this, why?: Notice the green "Array"?

I haven't really been able to find any answer...

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

0

Use console.dir instead of console.log

console.dir(data, {depth:100})

Its having a depth parameter to expand json upto given level

about 4 years ago · Juan Pablo Isaza Denunciar

0

You need to use JSON.stringify to convert the object to JSON string. So you need to change your code like this:

let wordBank = './Wordbank.json';
function getData() {
   console.log(JSON.stringify(require(wordBank)));
}
getData();
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