loading...

re: How can I read a local JSON file in HTML/JavaScript? VIEW POST

FULL DISCUSSION
 

No idea if this works for your use-case, but you could define a JS file which exports a object with the same content. Then you could import it as any other JS-file.

 

I never thought of that, as I primarily use the .json format for it's syntax highlighting, thank you.

 

Depending on your editor and theme, I think you should be able to have nice highlighting in JS files as well. As you said in the end JSON is JS. Hope you can find something which works for you!

 

You shouldn't exclusively use a format because you like it's highlighting, though. JSON has it's use cases, but it's not perfect everywhere ;-;

I know, but I almost need syntax highlighting, even if there's little to highlight, or if there's little differences, it tells me what to do, I haven't stated it yet, but I have a vision impairment, so syntax highlighting is definitely a big thing, especially with smaller, or even sometimes, normally sized text, this is weakened by my (sometimes, now mostly limited) access to my PC which has a big resolution monitor accompanying it.

Sorry I made that so long.
Also, maybe JSON isn't big everywhere, but even big games use it, and look at all the MC map creating community, commands use a JSON format. So really, JSON just needs more love.

But I digress, sorry for making such a long, (and admittedly) tangent.
Have a wonderful day. Cheers!

code of conduct - report abuse