首页 新闻 会员 周边 捐助

下面的百度百科Api的json怎么把他遍历出来?实际没有操作过在项目中。

0
悬赏园豆:20 [已解决问题] 解决于 2017-05-05 22:20

{"id":26096,"subLemmaId":7373792,"newLemmaId":27263,"key":"\u94f6\u9b42","desc":"\u7a7a\u77e5\u82f1\u79cb\u521b\u4f5c\u7684\u6f2b\u753b","title":"\u94f6\u9b42","card":[{"key":"m21_bookname","name":"\u4e2d\u6587\u540d","value":["\u94f6\u9b42"],"format":["\u94f6\u9b42"]},{"key":"m21_originalname","name":"\u539f\u7248\u540d\u79f0","value":["\u9280\u9b42"],"format":["\u9280\u9b42"]},{"key":"m21_othername","name":"\u5176\u4ed6\u540d\u79f0","value":["GINTAMA\uff0c\u304e\u3093\u305f\u307e"],"format":["GINTAMA\uff0c\u304e\u3093\u305f\u307e"]},{"key":"m21_author","name":"\u4f5c\u8005","value":["<a target=_blank href="\/view\/87122.htm">\u7a7a\u77e5\u82f1\u79cb<\/a>"],"format":["<a target=_blank href="\/view\/87122.htm">\u7a7a\u77e5\u82f1\u79cb<\/a>"]},{"key":"m21_booktype","name":"\u7c7b\u578b","value":["\u5e55\u672b\u3001\u641e\u7b11\u3001\u79d1\u5e7b\u3001\u52a8\u4f5c"],"format":["\u5e55\u672b\u3001\u641e\u7b11\u3001\u79d1\u5e7b\u3001\u52a8\u4f5c"]},{"key":"m21_bookregion","name":"\u5730\u533a","value":["\u65e5\u672c"],"format":["\u65e5\u672c"]},{"key":"m21_seriesmagazine","name":"\u8fde\u8f7d\u6742\u5fd7","value":["\u300a<a target=_blank href="\/view\/473852.htm">\u5468\u520a\u5c11\u5e74JUMP<\/a>\u300b"],"format":["\u300a<a target=_blank href="\/view\/473852.htm">\u5468\u520a\u5c11\u5e74JUMP<\/a>\u300b"]},{"key":"m21_seriesnum","name":"\u63ed\u8f7d\u53f7","value":["2004\u5e742\u53f7"],"format":["2004\u5e742\u53f7"]},{"key":"m21_seriesperiod","name":"\u8fde\u8f7d\u671f\u95f4","value":["2003\u5e7412\u6708\uff0d\u8fde\u8f7d\u4e2d"],"format":["2003\u5e7412\u6708\uff0d\u8fde\u8f7d\u4e2d"]},{"key":"m21_press","name":"\u51fa\u7248\u793e","value":["<a target=_blank href="\/view\/30883.htm">\u96c6\u82f1\u793e<\/a>"],"format":["<a target=_blank href="\/view\/30883.htm">\u96c6\u82f1\u793e<\/a>"]},{"key":"m21_publishperiod","name":"\u51fa\u7248\u671f\u95f4","value":["2004\u5e744\u6708\uff0d"],"format":["2004\u5e744\u6708\uff0d"]},{"key":"m21_volumes","name":"\u5355\u884c\u672c\u518c\u6570","value":["64\u5377\uff082016\u5e745\u6708\uff09"],"format":["64\u5377\uff082016\u5e745\u6708\uff09"]},{"key":"m21_otherpress","name":"\u5176\u4ed6\u51fa\u7248\u793e","value":["\u4e2d\u56fd\u53f0\u6e7e\uff1a<a target=_blank href="\/view\/1353966.htm">\u4e1c\u7acb\u51fa\u7248\u793e<\/a>","\u4e2d\u56fd\u9999\u6e2f\uff1a<a target=_blank href="\/view\/6941397.htm">\u6b63\u6587\u793e<\/a>","\u4e2d\u56fd\u5927\u9646\uff1a<a target=_blank href="\/item\/%E8%BF%9E%E7%8E%AF%E7%94%BB%E5%87%BA%E7%89%88%E7%A4%BE">\u8fde\u73af\u753b\u51fa\u7248\u793e<\/a>\uff08\u51fa\u7248\uff09\u3001\u5317\u4eac\u4e2d\u5c11\u52a8\u6f2b\uff08\u53d1\u884c\uff09","\u65b0\u52a0\u5761\uff1a\u521b\u827a\u51fa\u7248\u793e"],"format":["\u4e2d\u56fd\u53f0\u6e7e\uff1a<a target=_blank href="\/view\/1353966.htm">\u4e1c\u7acb\u51fa\u7248\u793e<\/a>","\u4e2d\u56fd\u9999\u6e2f\uff1a<a target=_blank href="\/view\/6941397.htm">\u6b63\u6587\u793e<\/a>","\u4e2d\u56fd\u5927\u9646\uff1a<a target=_blank href="\/item\/%E8%BF%9E%E7%8E%AF%E7%94%BB%E5%87%BA%E7%89%88%E7%A4%BE">\u8fde\u73af\u753b\u51fa\u7248\u793e<\/a>\uff08\u51fa\u7248\uff09\u3001\u5317\u4eac\u4e2d\u5c11\u52a8\u6f2b\uff08\u53d1\u884c\uff09","\u65b0\u52a0\u5761\uff1a\u521b\u827a\u51fa\u7248\u793e"]},{"key":"m21_ext_0","name":"\u7f51\u7edc\u8fde\u8f7d","value":["<a target=_blank href="\/view\/7833310.htm">\u817e\u8baf\u52a8\u6f2b<\/a>\uff08\u4e2d\u56fd\u5927\u9646\uff09"],"format":["<a target=_blank href="\/view\/7833310.htm">\u817e\u8baf\u52a8\u6f2b<\/a>\uff08\u4e2d\u56fd\u5927\u9646\uff09"]}],"image":"http:\/\/imgsrc.baidu.com\/baike\/pic\/item\/8d5494eef01f3a295021f8289825bc315d607c6e.jpg","src":"8d5494eef01f3a295021f8289825bc315d607c6e","imageHeight":768,"imageWidth":512,"isSummaryPic":"y","abstract":"\u300a\u94f6\u9b42\u300b\u662f\u7531\u65e5\u672c\u6f2b\u753b\u5bb6\u7a7a\u77e5\u82f1\u79cb\u521b\u4f5c\u7684\u5c11\u5e74\u6f2b\u753b\u4f5c\u54c1\uff0c\u4e8e2004\u5e742\u53f7\u7684\u300a\u5468\u520a\u5c11\u5e74Jump\u300b\u5f00\u59cb\u8fde\u8f7d\u30022006\u5e744\u67084\u65e5\u8d77\uff0c\u7531\u65e5\u5347\u52a8\u753b\u6539\u7f16\u7684\u540c\u540d\u7535\u89c6\u52a8\u753b\u5f00\u59cb\u5728\u4e1c\u4eac\u7535\u89c6\u53f0\u653e\u9001\u3002\u622a\u81f32016\u5e747\u67083\u65e5\uff0c\u300a\u94f6\u9b42\u300b\u5355\u884c\u672c\u7d2f\u8ba1\u53d1\u884c\u91cf\u7a81\u78345000\u4e07\u518c\u3002","moduleIds":[125196531,125196532,125196533,125196534,125196535,125196536,125196537,125196538,125196539,125196540,125196541,125196542,125196543,125196544,125196545,125196546],"url":"http:\/\/baike.baidu.com\/subview\/26096\/7373792.htm","wapUrl":"http:\/\/wapbaike.baidu.com\/subview\/26096\/7373792.htm","hasOther":1,"totalUrl":"http:\/\/baike.baidu.com\/view\/26096.htm","catalog":["\u521b\u4f5c\u80cc\u666f<\/a>","\u5267\u60c5\u7b80\u4ecb<\/a>","\u767b\u573a\u89d2\u8272<\/a>","\u7528\u8bed\u89e3\u8bf4<\/a>"],"wapCatalog":["\u521b\u4f5c\u80cc\u666f<\/a>","\u5267\u60c5\u7b80\u4ecb<\/a>","\u767b\u573a\u89d2\u8272<\/a>","\u7528\u8bed\u89e3\u8bf4<\/a>"],"logo":"http:\/\/img.baidu.com\/img\/baike\/logo-baike.gif","copyrights":"\u4ee5\u4e0a\u5185\u5bb9\u6765\u81ea\u767e\u5ea6\u767e\u79d1\u5e73\u53f0\uff0c\u7531\u767e\u5ea6\u767e\u79d1\u7f51\u53cb\u521b\u4f5c\u3002","customImg":"","redirect":[]}


Model-Zachary的主页 Model-Zachary | 菜鸟二级 | 园豆:212
提问于:2016-12-09 09:30
< >
分享
最佳答案
0

1.什么叫原生ajax?

2.这种json数据为什么是要用ajax遍历?

收获园豆:20
~扎克伯格 | 小虾三级 |园豆:1923 | 2016-12-09 09:36

我概念上的模糊把,总感觉有数据交互的基本都用ajax,再说下为什么说原生,因为好多人都依赖像jq之类的库自带的ajax,我已经改过来了。就是把这个json数据遍历出来,前端数据交互这块很缺失


Model-Zachary | 园豆:212 (菜鸟二级) | 2016-12-09 09:41

@model-zachary: json数据遍历交给遍历器不就行了吗?数据交互ajax的确用的多,但是处理json数据和数据交互是两个概念,不能混淆哦!

~扎克伯格 | 园豆:1923 (小虾三级) | 2016-12-09 09:44

@~扎克伯格: 但是一般数据交互的数据格式都是json的,那是不是根据调用数据的性质来看,是否用ajax?再白一点就是虽然都是json数据,异步用的多,比如表单,这个就用ajax,其他可以用普通的遍历,把信息轮询一遍就可以了,也就是同步的,对吗?那么我萌生出一个疑问,他们的json写法都一样吗?谢谢大神


Model-Zachary | 园豆:212 (菜鸟二级) | 2016-12-09 09:48

@model-zachary: 1.如果单纯说前后端数据交互的话,ajax传后台data主要是key-value形式的,但是返回的datatype有很多:xml、html、script、json、jsonp、text;

2、"再白一点就是虽然都是json数据,异步用的多,比如表单,这个就用ajax,其他可以用普通的遍历,把信息轮询一遍就可以了,也就是同步的,对吗?那么我萌生出一个疑问,他们的json写法都一样吗?"不知所云。

3.个人建议:不要只看概念去遐想,多动动手自然都会明白。不要管是不是原生,你先会用人家的再说。

~扎克伯格 | 园豆:1923 (小虾三级) | 2016-12-09 09:59

@~扎克伯格: 恩,我通过node搭建了一个本地服务器,正在模拟后台进行数据的通信,以表单的为例,谢谢。


Model-Zachary | 园豆:212 (菜鸟二级) | 2016-12-09 10:05
其他回答(4)
0

其实这不太明白,很想帮助你的 兄弟

muamuamua | 园豆:222 (菜鸟二级) | 2016-12-09 09:47
0

有没有这个转换

function show(i) {
        $.ajax({
            type: "get",
            url: "http://localhost:32629/api/Default/GetStr",
            success: function (d) {
                var p = jQuery.parseJSON(d);
                $(p).each(function (i, obj) {
                    var r = "<tr><td>" + obj.Cid + "</td><td>" + obj.Cname + "</td><td>" + obj.Cprice + "</td><td>" + obj.Cnowprice + "</td><td>" + obj.Csonnum + "</td><td>" + obj.CpicUrl + "</td><td><a href='#' onclick=del(" + obj.Cid + ")>删除</a></td></tr>";
                    $("#aaa tbody").append(r);
                })
            }
        })
    }

 

liangtong | 园豆:305 (菜鸟二级) | 2016-12-09 09:48

看一楼大侠及我的回复,可能是我的概念搞混淆了,有些数据,非异步虽然也是json格式,可以用普通的遍历遍历除数据来,异步,比如表单就用ajax,虽然数据交互用ajax比较多,但也要结合需求,对不,然后我想问下大侠,那个json格式我怎么引进来,像引入js那样吗?


支持(0) 反对(0) Model-Zachary | 园豆:212 (菜鸟二级) | 2016-12-09 09:52

@model-zachary: /// <summary>
        /// 获取数据
        /// </summary>
        /// <returns></returns>
        public string Getstr()
        {
            List<QQQ> list=bll.show();
            string  Json = JsonConvert.SerializeObject(list, new DataSetConverter());
            return Json;
        }

 

转成json格式

支持(0) 反对(0) liangtong | 园豆:305 (菜鸟二级) | 2016-12-09 10:00
0

没太明白你想干什么,


来地球转一圈 | 园豆:213 (菜鸟二级) | 2016-12-09 21:01
0

遍历不是很简单?for(var key in jsondata){}

jasondyoung | 园豆:424 (菜鸟二级) | 2016-12-11 20:10
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册