后台得到前台传输过来的json数组,如下
string str="\"[
{'latitude':116.40091896057129,'longitude':39.931129903495886},
{'latitude':116.40194892883301,'longitude':39.946134395563796},
{'latitude':116.39645576477051,'longitude':39.95488549657055}]\""请问怎么解析这个json数组,最好还是得到一个对象。
object[0].latitude=xx
object[1].longitude=xx
谢谢

解决方案 »

  1.   


    $('#send').click(function() {
                 $.getJSON('test.json', function(data) {
                     $('#resText').empty();
      var html = '';
      $.each( data  , function(commentIndex, comment) {
      html += '<div class="comment"><h6>' + comment['username'] + ':</h6><p class="para">' + comment['content'] + '</p></div>';
      })
     $('#resText').html(html);
                })
           })这是一个完整的解析,不过,把json写在 了一个文件里