No, JSON.parse() does not use eval()
This is by design, since eval() can execute any arbitrary JavaScript code that you feed it, it can execute those things that you do not need. So JSON.parse() does what it says about the gesture: it actually parses the entire string and reconstructs the whole tree of objects.
JSON.parse usually delegated to an internal function implemented with "native" code, where "native" means everything that is considered "native" in the context of your javascript engine browser (machine code may be compiled, there may be bytecode for VM, etc. d.). I do not think there is any strong demand.
Differences in implementations?
JSON (designation itself) is encoded by RFC4627 .
Regarding the implementation of the JSON object and its methods, all modern modern browsers should behave the same, as they must follow the same specifications for the ECMAScript 5 JSON object . However, there is always the possibility of potential defects. For example, V8 originally contained this nasty bug .
Also, note that the implementation listed in the comments above is intended to add JSON.parse() support for browsers that don't support it natively (also called "these damn old browsers that you sometimes need to support"). But this does not mean that it is necessary how they implemented it.
For example, for the Google V8 implementation used in Chrome, see json.js , which calls native code from json_parser.h .
source share