JSON File not loading

I’m currently making an application in which I use JSON files to compare values that the user inputs, I’ve tried multiple ways to call the JSON file but I can’t seem to get it to work. It doesn’t show up in the development tools, any way that I can fix this?

Check your project settings, under the Design > Bootstrap section, and make sure you have the jquery version chosen.

Still doesn’t work, using jQuery 3.6.0, pressed save, restarted application, cleared browser cache

Hmm not sure what else to try there, maybe someone else will have some other ideas on it. Hang in there, someone usually does. :slight_smile:

Add this in a js file

const loadData = async (url) => {
	try {
		const response = await fetch(url);
		let data = await response.json();
		// do something with your JSON data
		console.log(data);
	} catch (err) {
			console.warn(err);
	}	
};
loadData('assets/js/THE-NAME-OF-YOUR-JSON.json');

@Aeiral

if you click on admin you can change the data.

I found that if I installed Python3 then I could use the http.server module to invoke the JSON processor.

After installing Python3, make a new text file with the “.bat” extension in the folder where you have your HTML files (I called mine http.bat). Insert this line into your http.bat file:-

python3 -m http.server 8000 --bind 127.0.0.1

Run this batch file BEFORE trying to preview your JSON-based webpage. Make sure you set the preview to use “http://127.0.0.1:8000” in the BSS preview settings (i.e. to match the settings that are called in the batch file above.
Good luck (this took me about 6 months to figure out, after wasting heaps of time learning Node.js and others…)
RedCat35

1 Like

I can’t seem to get the bat file into bootstrap studio. Do I need to export first, add it and then try?

Anyone who might be able to help me with this?

Could it be that I need to load this in the head tag? If so, what could be the “path” ?

I don’t use the export options at all so I can’t be of any help, but have you read the docs at all on this? The Export section has information on how to use this feature.

Wasn’t about exporting, was trying to see if putting the jQuery script in the head tag would give me a solution