Nothing returned when trying to get data from json file

I am trying to read json data stored locally but being new to this, I feel like I am missing something obvious.

Here is the JSON data in the file called App.json
file

This is the file relative to the rest of the project.
file

The project file… (I get that the includes isn’t necessary for everything but I have been trying variations of included files)
file

And the file that is running and returning nothing within “foo”

file

And lastly, the result in console on refreshing.

file

I have looked around at a variation of ways to do this but I feel like it’s not finding the file.

Much thanks,

Hi Chris,

could you please post a complete, minimal reproduction that someone else could try to run?

Other than that, here’s two things you could try:

  • Bundle.readSync("Data/App.json")
  • read instead of readSync:
Bundle.read("Data/App.json").then(function(x) {
    console.log("read: " + JSON.stringify(x));
});

The change to the file call is what fixed it.

Much appreciated!