Thanks to the rise of Ajax, the lightweight data format of JSON became increasingly popular as a transfer format between the client and the server, and the problem was how to convert the server-side-built JSON data into usable JavaScript objects. Using the Eval function is undoubtedly a simple and straightforward approach. When converting, you need to wrap the outside of the JSON string in parentheses:
var jsonobject = eval ("+ Jsonformat +"));
Why do I have braces?
The purpose of parentheses is to force the Eval function to force an expression in parentheses (expression) into an object when processing JavaScript code instead of executing as a statement (statement). For example, an object literal {}, if the outer bracket is not added, Eval recognizes the curly braces as the opening and closing tags of the JavaScript code block, then {} will be considered to have executed an empty statement. So the following two execution results are different:
Alert (eval ("{}");//return undefined
Alert (eval ({}));/return Object[object]