Ask coding questions

← Back to all posts
[JS] How do you get a local JSON file and turn it into an object?
MrVoo

I've been googling this for way to long and I can't find an answer. Also, I'm not using NodeJS, just regular JS.

Voters
sobakarooted
MrVoo
Comments
hotnewtop
SixBeeps

Wait, you're using browser JS and you're trying to load a JSON file on the client's computer?

MrVoo

@SixBeeps No, on replit. Like main.js and thing.json are in the same replit folder thingy.... can you understand any of what I just said?

SixBeeps

@MrVoo Ok so you're not using Node, and you're not using browser JS. What kind of framework are you using then?

MrVoo

@SixBeeps Well, I'm just using Kaboom :P That's just normal JS... I did find a way to READ json files, but I can't store them in a variable

SixBeeps

@MrVoo Oh actually Kaboom executes in browser space, so it's technically browser JS.

MrVoo

@SixBeeps Can browser JS not put json into a variable?