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

137
Vistas
Visual StudioCode Intellisense after parsing Json file

My backend is built with express (so basically javascript). The backend is also able to save some data to .json files and use this data.

var data = JSON.parse(fs.readFileSync("path/data.json"));

It would help me a lot, if Visual Studio Code would provide Intellisense for my data object (like suggesting all elements of this json file). Is there any addon for this kind of "problem" ?

Example:

{
    "owner": "testperson",
    "age": "30"
}

After parsing this json file (exact way like on top), it would be very helpful to have Intellisense after writing

data. 
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

There is a built-in solution in VSCode exactly that manner. To get intellisense VSCode needs to know what the type of something is and for that you can use JSDoc comments, if you want to stick to JavaScript. These are understood by VSCode without any problem. The snippet down below is applies to your given example.

/**
  * @typedef {Object} MyData
  * @property {string} owner
  * @property {number} age
*/

/**
  * @type {MyData}
*/
let data = JSON.parse(fs.readFileSync("path/data.json"));

For further reading I refer to the JSDoc docs.

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