html接收json格式的数据

下面是一串json格式的数据,它的地址是localhost:8080/baowen/toBaowen

我现在想在html中把它接收到,并且依次遍历出来显示在一竖列的表格上

求大神指点 成功了立马采纳

{"d4":[7404674,7404676,7404676,7404674,7404676,7404674,7404679,7404681,7404679,7404681,7404679,7404681,7404684,7404686,7404686,7404684,7404686,7404684,7404691,7404689,7404689,7404691,7404689,7404691,7404694,7404696,7404696,7404694,7404696,7404694,7404707,7404705,7404705,7404707,7404705,7404707,7404719,7404717,7404717,7404719,7404717,7404719,7404730,7404732,7404730,7404732,7404730,7404732,7404737,7404735,7404735,7404737,7404735,7404737,7404745,7404743,7404745,7404743,7404745,7404743,7404750,7404748,7404750,7404748,7404750,7404748,7404753,7404755,7404755,7404753,7404755,7404753,7404760,7404758,7404760,7404758,7404760,7404758,7404765,7404763,7404765,7404763,7404765,7404763,7404768,7404770,7404770,7404768,7404770,7404768,7404779,7404777,7404779,7404777,7404779,7404777,7404791,7404789,7404789,7404791,7404789,7404791,7404803,7404801,7404803,7404801,7404803,7404801,7404815,7404813,7404815,7404813,7404815,7404813,7404828,7404826,7404828,7404826,7404828,7404826,7404833,7404831,7404833,7404831,7404833,7404831,7404838,7404836,7404838,7404836,7404838,7404836,7404846,7404844,7404844,7404846,7404844,7404846,7404851,7404849,7404851,7404849,7404851,7404849,7404854,7404856,7404856,7404854,7404856,7404854,7404861,7404859,7404861,7404859,7404861,7404859,7404874,7404872,7404874,7404872,7404874,7404872,7404877,7404879,7404877,7404879,7404877,7404879,7404883,7404885,7404883,7404885,7404883,7404885,7404891,7404893,7404891,7404893,7404891,7404893,7404897,7404899,7404899,7404897,7404899,7404897,7404902,7404904,7404902,7404904,7404902,7404904,7404909,7404907,7404909,7404907,7404909,7404907,7404915,7404913,7404915,7404913,7404915,7404913,7404919,7404921,7404919,7404921,7404919,7404921,7404931,7404929,7404931,7404929,7404931,7404929,7404945,7404944,7404943,7404944,7404943,7404945,7404944,7404943,7404945,7404944,7404945,7404943,7404946,7404947,7404948,7404944,7404948,7404947,7404946,7404948,7404947,7404946,7404947,7404948,7404947,7404946,7404943,7404945,7404948,7404946,7404965,7404958,7404962,7404967,7404961,7404959,7404957,7404960,7404958,7404960,7404957,7404959,7404961,7404962,7404961,7404960,7404958,7404959,7404965,7404960,7404957,7404961,7404967,7404962,7404961,7404957,7404960,7404965,7404959,7404958,7404962,7404957,7404967,7404962,7404959,7404958,7404996,7404998,7404998,7404996,7404998,7404996,7405017,7405019,7405019,7405017,7405019,7405017,7405063,7405061,7405061,7405063,7405061,7405063]}

在后台做处理么,将结果先存放到一个list中,然后将list转为json串
JSONArray array = JSONArray.fromObject(list);
String jsonArray = array.toString();
这样处理完之后在页面写一个ajax接收到,然后循环就行了么

 <script>
  var   json={"d4":[7404674,7404676,7404676,7404674,7404676,7404674,7404679,7404681,7404679,7404681,7404679,7404681,7404684,7404686,7404686,7404684,7404686,7404684,7404691,7404689,7404689,7404691,7404689,7404691,7404694,7404696,7404696,7404694,7404696,7404694,7404707,7404705,7404705,7404707,7404705,7404707,7404719,7404717,7404717,7404719,7404717,7404719,7404730,7404732,7404730,7404732,7404730,7404732,7404737,7404735,7404735,7404737,7404735,7404737,7404745,7404743,7404745,7404743,7404745,7404743,7404750,7404748,7404750,7404748,7404750,7404748,7404753,7404755,7404755,7404753,7404755,7404753,7404760,7404758,7404760,7404758,7404760,7404758,7404765,7404763,7404765,7404763,7404765,7404763,7404768,7404770,7404770,7404768,7404770,7404768,7404779,7404777,7404779,7404777,7404779,7404777,7404791,7404789,7404789,7404791,7404789,7404791,7404803,7404801,7404803,7404801,7404803,7404801,7404815,7404813,7404815,7404813,7404815,7404813,7404828,7404826,7404828,7404826,7404828,7404826,7404833,7404831,7404833,7404831,7404833,7404831,7404838,7404836,7404838,7404836,7404838,7404836,7404846,7404844,7404844,7404846,7404844,7404846,7404851,7404849,7404851,7404849,7404851,7404849,7404854,7404856,7404856,7404854,7404856,7404854,7404861,7404859,7404861,7404859,7404861,7404859,7404874,7404872,7404874,7404872,7404874,7404872,7404877,7404879,7404877,7404879,7404877,7404879,7404883,7404885,7404883,7404885,7404883,7404885,7404891,7404893,7404891,7404893,7404891,7404893,7404897,7404899,7404899,7404897,7404899,7404897,7404902,7404904,7404902,7404904,7404902,7404904,7404909,7404907,7404909,7404907,7404909,7404907,7404915,7404913,7404915,7404913,7404915,7404913,7404919,7404921,7404919,7404921,7404919,7404921,7404931,7404929,7404931,7404929,7404931,7404929,7404945,7404944,7404943,7404944,7404943,7404945,7404944,7404943,7404945,7404944,7404945,7404943,7404946,7404947,7404948,7404944,7404948,7404947,7404946,7404948,7404947,7404946,7404947,7404948,7404947,7404946,7404943,7404945,7404948,7404946,7404965,7404958,7404962,7404967,7404961,7404959,7404957,7404960,7404958,7404960,7404957,7404959,7404961,7404962,7404961,7404960,7404958,7404959,7404965,7404960,7404957,7404961,7404967,7404962,7404961,7404957,7404960,7404965,7404959,7404958,7404962,7404957,7404967,7404962,7404959,7404958,7404996,7404998,7404998,7404996,7404998,7404996,7405017,7405019,7405019,7405017,7405019,7405017,7405063,7405061,7405061,7405063,7405061,7405063]}
         jsonws = json.d4;
         alert(jsonws);
            for(var i=0;i<jsonws.length;i++){
            alert(jsonws[i]);
            }
  </script>

<html>
<head>
<meta http-equiv="Content-Type" content="text/plain;" />
<script src="js/jquery.js" type="text/javascript"></script>
<script type="text/javascript">
$(function()
{
    $.getJSON("/baowen/toBaowen", function(data){
        for(var ss in data)
        {
            //alert(data[ss]);
            var html='<table border="1" rules="rows">';
            for(item in data[ss])
            {
                //alert(data[ss][item]);
                html+='<tr><td>'+data[ss][item]+'</td></tr>';
            }
            html+='</table>'
            document.getElementById("mytable").innerHTML = html;
        }
    }
})
</script>
</head>
<body>
    <div id='mytable'></div>    
</body>
</html>

var json="{\"d4\":\"[7404674,7404676,7404676,7404674,7404676,7404674,7404679,7404681,7404679,7404681,7404679,7404681,7404684,7404686,7404686,7404684,7404686,7404684,7404691,7404689,7404689,7404691,7404689,7404691,7404694,7404696,7404696,7404694,7404696,7404694,7404707,7404705,7404705,7404707,7404705,7404707,7404719,7404717,7404717,7404719,7404717,7404719,7404730,7404732,7404730,7404732,7404730,7404732,7404737,7404735,7404735,7404737,7404735,7404737,7404745,7404743,7404745,7404743,7404745,7404743,7404750,7404748,7404750,7404748,7404750,7404748,7404753,7404755,7404755,7404753,7404755,7404753,7404760,7404758,7404760,7404758,7404760,7404758,7404765,7404763,7404765,7404763,7404765,7404763,7404768,7404770,7404770,7404768,7404770,7404768,7404779,7404777,7404779,7404777,7404779,7404777,7404791,7404789,7404789,7404791,7404789,7404791,7404803,7404801,7404803,7404801,7404803,7404801,7404815,7404813,7404815,7404813,7404815,7404813,7404828,7404826,7404828,7404826,7404828,7404826,7404833,7404831,7404833,7404831,7404833,7404831,7404838,7404836,7404838,7404836,7404838,7404836,7404846,7404844,7404844,7404846,7404844,7404846,7404851,7404849,7404851,7404849,7404851,7404849,7404854,7404856,7404856,7404854,7404856,7404854,7404861,7404859,7404861,7404859,7404861,7404859,7404874,7404872,7404874,7404872,7404874,7404872,7404877,7404879,7404877,7404879,7404877,7404879,7404883,7404885,7404883,7404885,7404883,7404885,7404891,7404893,7404891,7404893,7404891,7404893,7404897,7404899,7404899,7404897,7404899,7404897,7404902,7404904,7404902,7404904,7404902,7404904,7404909,7404907,7404909,7404907,7404909,7404907,7404915,7404913,7404915,7404913,7404915,7404913,7404919,7404921,7404919,7404921,7404919,7404921,7404931,7404929,7404931,7404929,7404931,7404929,7404945,7404944,7404943,7404944,7404943,7404945,7404944,7404943,7404945,7404944,7404945,7404943,7404946,7404947,7404948,7404944,7404948,7404947,7404946,7404948,7404947,7404946,7404947,7404948,7404947,7404946,7404943,7404945,7404948,7404946,7404965,7404958,7404962,7404967,7404961,7404959,7404957,7404960,7404958,7404960,7404957,7404959,7404961,7404962,7404961,7404960,7404958,7404959,7404965,7404960,7404957,7404961,7404967,7404962,7404961,7404957,7404960,7404965,7404959,7404958,7404962,7404957,7404967,7404962,7404959,7404958,7404996,7404998,7404998,7404996,7404998,7404996,7405017,7405019,7405019,7405017,7405019,7405017,7405063,7405061,7405061,7405063,7405061,7405063]\"}";//需要变成这种格式不知道你那个d4没有转移符怎么加上去的str.replaceAll('"','\"').replaceAll('[','\"[').replaceAll(']',']\"')

json = $.parseJSON(json);
alert(json.d4);效果图
![图片说明](https://img-ask.csdn.net/upload/201702/22/1487751710_914537.png)

图片说明