Im new to js and i dont understand how can i take an object from json file,
for example this file : local.json
{
"server": "myname",
"url": 10.0.0.1
}
I need to get the url to insert in in my js code like this, replace the 127.0.0.1 with what i have in json file at url:
import axios from 'axios';
import jsonFile from '../local.json';
const http = require("http");
const host = '127.0.0.1'; #should be 10.0.0.1 from json file
.) OR SQUARE BRACKET ([ ]) Example:-const host = jsonFile.urlORconst host = json["url"]jsonFilein the same way you'd access any property in a standard JS object (because that's what it now is: JSON is the string representation of a JS object; once parsed, it is an object, and no longer JSON string data)