- Xiaomi 13 - felnőni nehéz
- Búcsúkönnyek a Galaxy S21 utolsó fellépésén
- Samsung Galaxy A54 - türelemjáték
- Google Pixel 9a - a lapos munka
- Honor Magic6 Pro - kör közepén számok
- Motorola Edge 50 Neo - az egyensúly gyengesége
- Szívós, szép és kitartó az új OnePlus óra
- Honor Magic8 Pro - bevált recept kölcsönvett hozzávalókkal
- Külföldi prepaid SIM-ek itthon
- Xiaomi Mi 10T Pro - a házon belüli ellenfél
-
Mobilarena
JavaScript != Java (A JavaScript nem összekeverendő a Javával, két különböző programozási nyelvről van szó!)
Új hozzászólás Aktív témák
-
Sk8erPeter
nagyúr
Szívesen!

Innen érthető meg elég jól, mit is csinál a JSON.parse(), lényegében hasonló az eval()-hoz, csak az a nagy különbség, hogy a JSON.parse() nem engedi lefutni pl. az esetlegesen kártékony JavaScript-kódot. Az eval()-nak pedig épp ez a nagy veszélye, hogy rajta keresztül lefuthatnak a rosszindulatú kódok.
Idézet:
"To convert a JSON text into an object, you can use the eval() function. eval() invokes the JavaScript compiler. Since JSON is a proper subset of JavaScript, the compiler will correctly parse the text and produce an object structure. The text must be wrapped in parens to avoid tripping on an ambiguity in JavaScript's syntax.
var myObject = eval('(' + myJSONtext + ')');The eval function is very fast. However, it can compile and execute any JavaScript program, so there can be security issues. The use of eval is indicated when the source is trusted and competent. It is much safer to use a JSON parser. In web applications over XMLHttpRequest, communication is permitted only to the same origin that provide that page, so it is trusted. But it might not be competent. If the server is not rigorous in its JSON encoding, or if it does not scrupulously validate all of its inputs, then it could deliver invalid JSON text that could be carrying dangerous script. The eval function would execute the script, unleashing its malice.
To defend against this, a JSON parser should be used. A JSON parser will recognize only JSON text, rejecting all scripts. In browsers that provide native JSON support, JSON parsers are also much faster than eval. It is expected that native JSON support will be included in the next ECMAScript standard.
var myObject = JSON.parse(myJSONtext, reviver);"
Új hozzászólás Aktív témák
- www.olcsogamerpc.hu - V051 - DDR4 - INTEL i5-12400F - 16GB RAM - RTX 5060 - 1TB SSD - HITELRE IS!
- www.olcsogamerpc.hu - V018- DDR4 - INTEL i5-10400F - 16GB RAM - RTX 3060 12GB - 1TB SSD- HITELRE IS!
- www.olcsogamerpc.hu - V071- DDR4 - INTEL i5-14400F - 16GB RAM - RTX 5060Ti - 1TB SSD - HITELRE IS!
- GARANCIÁLIS! Intel Ultra 7 265KF+Asus RTX5080+64GB 6000Mhz RAM+2x1TB Nvme SSD+Asus ROG B860F Wifi7
- www.olcsogamerpc.hu - V065 - DDR4 - INTEL i5-12400F - 16GB RAM - RTX 5060Ti - 1TB SSD - HITELRE IS!
- ÁRGARANCIA!Épített KomPhone i5 12400F 16/32/64GB RAM RTX 5060 Ti 16GB GAMER PC termékbeszámítással
- Keresünk iPhone 16/16e/16 Plus/16 Pro/16 Pro Max
- Keresünk iPhone 14/14 Plus/14 Pro/14 Pro Max
- Bomba ár! Dell Latitude E7250 - i5-5300U I 8GB I 128SSD I 12,5" HD I HDMI I Cam I W10 I Garancia!
- GYÖNYÖRŰ iPhone 12 mini 256GB Red -1 ÉV GARANCIA -Kártyafüggetlen, MS3627
Állásajánlatok
Cég: Central PC számítógép és laptop szerviz - Pécs
Város: Pécs
Cég: Laptopműhely Bt.
Város: Budapest



