What method can you use to read a local JSON file in Javascript for processing?
Or
What method can you use to read a JSON file hosted on a gist onto a Javascript file for processing?
OR
What framework/library can do any of these two with minimal effort?
Thanks in advance.
Node’s require
worked for me earlier for a local file. But since you mentioned jQuery, which of the two would be simpler or better? I’m eventually using gist for the final product. I wanted something for local development without depending on a gist. For now.
Do you have a working link to the gist with the JSON data /api? If so I’d just go with fetch
Note, for server side fetch you would need to download fetch from npm as it doesn’t come natively with node as it does client side
1 Like
Na just front end use. Thanks for your help.
Reading Local or External JSON files can be done from lots of methods. I really find jQuery getJSON method very useful when reading JSON.
Yeah fetch did it for me both locally and from an API. Thanks.
1 Like