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

345
Views
Get value of json file in javascript(nodejs)

So i want to get a value from a json file, but for the life of it, i cant get to understand what to write.

So if someone could help me write this line of code in javascript node, i would be grateful. I am trying to get the value of "totalCount"

This is from a library called GeoDb just for context.

main.js(NODEjs)

const timezone = require("./TimezonePortugal.json"); //referencing the json

console.log(timezone.metadata); // i dont know what to say afther this

TimezonePortugal.json

{"data":[{"code":"EUR","countryCodes":["PT","YT","IE","AD","IT","AT","RE","AX","BE","BL","SI","SK","SM","CY","DE","LT","LU","LV","MC","ME","MF","EE","MQ","MT","VA","ES","NL","FI","FR","GF","GP","GR","PM"],"symbol":"€"}],"metadata":{"currentOffset":0,"totalCount":1}}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

"." means inside. If you want to get value of totalCount you have to think like this:

timezone.metadata.totalCount = totalCount inside the metada, metadata inside the timezone

For example:

var timezone=
{
      "data":[
               {
                  "code":"EUR",
                  "countryCodes": ["PT","YT",],
                  "symbol":"€"
                }
              ],
  "metadata": {
                "currentOffset":0,
                "totalCount":1
               }
}
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!