javascript eval成json出错,太恼火了

这是从后台对出的字符串:
{"300001":{"current":3000.0,"highest":3000.0,"lowest":3000.0,"range":null,"sid":"300001","sname":"上证指数","tody":-1.0,"yesterday":3000.0},"601398":{"current":6.44,"highest":6.44,"lowest":6.44,"range":null,"sid":"601398","sname":"工商银行","tody":-1.0,"yesterday":6.44},"600000":{"current":25.0,"highest":25.0,"lowest":25.0,"range":null,"sid":"600000","sname":"浦发银行","tody":-1.0,"yesterday":25.0},"601857":{"current":1900.0,"highest":1900.0,"lowest":1900.0,"range":null,"sid":"601857","sname":"中国石油","tody":-1.0,"yesterday":1900.0}}

但我直接eval(),这个支付串的时候 firebug 提示invalid label错误, 若是在eval("\""+这个字符串+"\"");提示missing ; before statement 错误,
到底怎样我才能将这个字符串转化为json对象,
请各位给点意见//

1个回答

[color=darkblue][b]需要用括号把字符串括起来..[/b][/color]

[code="js"]var s = '{"300001":{"current":3000.0,"highest":3000.0,"lowest":3000.0,"range":null,"sid":"300001","sname":"上证指数","tody":-1.0,"yesterday":3000.0},"601398":{"current":6.44,"highest":6.44,"lowest":6.44,"range":null,"sid":"601398","sname":"工商银行","tody":-1.0,"yesterday":6.44},"600000":{"current":25.0,"highest":25.0,"lowest":25.0,"range":null,"sid":"600000","sname":"浦发银行","tody":-1.0,"yesterday":25.0},"601857":{"current":1900.0,"highest":1900.0,"lowest":1900.0,"range":null,"sid":"601857","sname":"中国石油","tody":-1.0,"yesterday":1900.0}} ';
eval("("+s+")")[/code]

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!