In JS, the JSON-formatted string is converted to a JSON object, the key code
JSON = eval (' (' +str+ ') ');
<!DOCTYPE HTML Public "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.w3.org/TR/xhtml1/DTD/ Xhtml1-transitional.dtd "><HTMLxmlns= "http://www.w3.org/1999/xhtml"><Head><Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8" /><title>JSON application</title><Scripttype= "Text/javascript">functionStrtojson (str) {JSON=Eval ('('+Str+')'); returnJSON;}functionToJSON (data) {JSON=eval (data); returnJSON;}//JSON dataStr= '{id:1,title: "Hello, Friend", Addtime: "2010-05-03"}'; Strjson=Strtojson (str);d ATA={ID:2, Title:"Hello, haha.", Addtime:"2010-05-04"}; Json=ToJSON (data);d Ocument.write (strjson.id+","+Strjson.title+" "+Strjson.addtime+"<br/>");d ocument.write (json.id+","+Json.title+" "+Json.addtime+"<br/>");</Script></Head><Body></Body></HTML>
A method of turning a string into a JSON object in JS