我要取一段json像这样的json
也就是说,一段json字符串,类似结构为
{"options":"[{\"text\":\"王家湾\",\"value\":\"9\"},
             {\"text\":\"李家湾\",\"valu e\":\"10\"},
             {\"text\":\"邵家湾\",\"value\":\"13\"}]"} 
我想取得options,这个字符串!大家谁知道的么?

解决方案 »

  1.   

    var c ={as:2234}
    var arr ='' ;
    for(var i in c)
    arr=i;
    alert(arr);  //出来的是as的字符串  用你的那个json直接报错
      

  2.   

    var jsonValue={ "options ": "[{\ "text\ ":\ "王家湾\ ",\ "value\ ":\ "9\ "}, 
                              {\ "text\ ":\ "李家湾\ ",\ "valu  e\ ":\ "10\ "}, 
                              {\ "text\ ":\ "邵家湾\ ",\ "value\ ":\ "13\ "}] "}  
    我要得到options .....
      

  3.   

    var jsonValue={ "要取这个字符串": "[{\ "text\ ":\ "王家湾\ ",\ "value\ ":\ "9\ "}, 
                              {\ "text\ ":\ "李家湾\ ",\ "valu  e\ ":\ "10\ "}, 
                              {\ "text\ ":\ "邵家湾\ ",\ "value\ ":\ "13\ "}] "}  
    明白了么?就是上图的那个字符串
      

  4.   

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
    <script type="text/javaScript">
    $(function($){
        $.each(jsonValue,function(k,o){
            alert(k);
        });
    }):
    </script>
      

  5.   

    json格式错误  
    改对了用2楼的方法就可