When I want to import JSON into my Node application following es6 like this:
import * as config from "./server-config.json" assert {type: 'json'}
When I try to use the imported values like this
console.log(config["url"])
It will just return the value undefined
. I am having this problem using Node 19, the path is correct, the json is correct and even if I use --experimental-json-modules
it will return an undefined
.