I reused some code that referenced an object in a .json file. The .json file was as follows:
{
"a": {
"b": "Hello world"
}
}
The original code referenced it as follows:
import * as newObj from "./test.json"
This didn't create the object correctly (although, it strangely ran perfectly in the original application". Changing it to the following worked:
import newObj from "./test.json"
Could anyone shed some light on how these two imports would differ, and possibly why it worked in the original form in one app, but needed to be changed in the second?
I have seen some answers around "import x vs import * as x" - but this question pertains specifically to how a json object is structured when imported in these 2 different ways.