Remix.run Logo
nswango 4 hours ago

For a long time the standard way of loading JSON was using eval.

bawolff 2 hours ago | parent | next [-]

Not that long, browsers implemented JSON.parse() back in 2009. JSON was only invented back in 2001 and took a while to become popular. It was a very short window more than a decade ago when eval made sense here.

Eval for json also lead to other security issues like XSSI.

creatonez 5 minutes ago | parent [-]

Problem is, it took until around 2016 for IE6 to be fully dead, so people continued to justify these hacks for a long time. Horrifying times.

creatonez 15 minutes ago | parent | prev | next [-]

For IE7 support, yes... https://caniuse.com/?search=JSON.parse

_flux 3 hours ago | parent | prev [-]

And why do we not anymore make use of it, but instead implemented separate JSON loading functionality in JavaScript? Can you think of any reasons beyond performance?

bawolff 2 hours ago | parent | next [-]

I'd be surprised if there is a performance benefit of processing json with eval(). Browsers optimize the heck out of JSON.

fhars 18 minutes ago | parent [-]

You are arguing against the opposite of what the comment you answered to said.

bulbar 3 hours ago | parent | prev [-]

Why did you opt in for such a comment while a straight forward response without belittling tone would have achieved the same?

_flux 3 hours ago | parent [-]

I actually gave it some thought. I had written the actual reason first, but I realized that the person I was responding to must know this, yet keeps arguing in that eval is just fine.

I would say they are arguing that in bad faith, so I wanted to enter a dialogue where they are either forced to agree, or more likely, not respond at all.