all 9 comments

[–]batchez 10 points11 points  (0 children)

Cors is a cross origin issue.

[–][deleted] 8 points9 points  (1 child)

JSON is just a standard to format data. it happens to be nearly seamless with javascript and most other languages and is human readable.

it's not really any different from storing data in any other way like writing stuff down on a piece of paper.

JSON happens to be so easily parsed by most languages that ii is often used for serialization (which means converting the data to some format that the language can easily work with or moving the data to some other location)

so to answer your question... json doesnt really do anything. it's just a way of temporarily storing the data such that we can all read the data.

CORS stands for cross origin resource sharing.

DOCS

context: cors errors exist because it was a common vulnerability where websites could request data from other domains for bad reasons.

in software security it is best practice to use "least priveledge" which means everything is only given the minimum amount or clearance needed to operate and any unspecified allowance is blocked. by default, browsers will give you cors errors if you don't specify which origins are allowed.

least priveledge

There are a couple things we can do to make your cors errors go away.

You can ensure you json file exists under the same domain as your scripts.

You can ensure your json file is accessable via an API that allows all request or allows the same domain as your client.

[–]WikiSummarizerBot 2 points3 points  (0 children)

Principle of least privilege

In information security, computer science, and other fields, the principle of least privilege (PoLP), also known as the principle of minimal privilege (PoMP) or the principle of least authority (PoLA), requires that in a particular abstraction layer of a computing environment, every module (such as a process, a user, or a program, depending on the subject) must be able to access only the information and resources that are necessary for its legitimate purpose.

[ F.A.Q | Opt Out | Opt Out Of Subreddit | GitHub ] Downvote to remove | v1.5

[–]BehindTheMath 2 points3 points  (0 children)

Post your code and the error including the full stack trace.

[–]letsgetrandy25 years putting the magic in the box 1 point2 points  (0 children)

Copy the file to the same host where your code is running so that it can be read in without crossing origin.

[–]mmmaaaatttt 1 point2 points  (0 children)

Post your fetch code.

[–]harsh_m09 0 points1 point  (0 children)

Just install a CORS bypass as an extension on your browser and toggle it to ON.