evalJSON :: String |
If the JSON string is not well formated or if a malicious attempt is detected a SyntaxError is thrown.
person = '{ "name": "Violet", "occupation": "character" }'.evalJSON(); person.name; //-> "Violet"
person = 'grabUserPassword()'.evalJSON(true); //-> SyntaxError: Badly formated JSON string: 'grabUserPassword()'
Note
Always set the sanitize parameter to true for data coming from externals sources to prevent XSS attacks.
See also
|
Prototype API 1.5.0 - prototypejs.org