Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

131
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!