<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> </head> <body> <script type="text/javascript"> a="{'username':'张三','sex':'男'}"; -------------字符串为双引号 obj=eval('('+a+')'); ------------------转换为对象 alert(a); </script> </body> </html>