Answer the question
In order to leave comments, you need to log in
How to call value from JSON file?
I created a json file, put the values I needed in it in this way:
{ "regions" : [
"hongkong",
"us-central",
"amsterdam",
"us-south",
"russia",
"us-east",
"south-korea",
"london",
"southafrica",
"europe",
"japan",
"eu-west",
"singapore",
"dubai",
"brazil",
"india",
"sydney",
"frankfurt",
"us-west"
] }
Answer the question
In order to leave comments, you need to log in
const config = require("./config.json");
alert(config['regions'][17])
const config = JSON.parse('ваш json');
const ind = config.regions.indexOf('frankfurt');
console.log(config.regions[ind]);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question