V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
uuuing
V2EX  ›  问与答

JS 问题, json 怎么读取

  •  
  •   uuuing · 2016-07-20 19:36:07 +08:00 · 1136 次点击
    这是一个创建于 3042 天前的主题,其中的信息可能已经有所发展或是发生改变。

    ###怎么读取

    {"resultcode":"200","reason":"SUCCESSED!","result":[{"data1":{"name":"美元","fBuyPri":"666.0300","mBuyPri":"660.6900","fSellPri":"668.7000","mSellPri":"668.7000","bankConversionPri":"669.4600","date":"2016-07-20","time":"18:20:03"},"data2":{"name":"欧元","fBuyPri":"731.8500","mBuyPri":"709.2700","fSellPri":"736.9900","mSellPri":"736.9900","bankConversionPri":"738.4000","date":"2016-07-20","time":"18:20:03"},"data3":{"name":"港币","fBuyPri":"85.8800","mBuyPri":"85.1900","fSellPri":"86.2000","mSellPri":"86.2000","bankConversionPri":"86.3200","date":"2016-07-20","time":"18:20:03"},"data4":{"name":"日元","fBuyPri":"6.2384","mBuyPri":"6.0459","fSellPri":"6.2822","mSellPri":"6.2822","bankConversionPri":"6.3183","date":"2016-07-20","time":"18:20:03"},"data5":{"name":"英镑","fBuyPri":"875.9000","mBuyPri":"848.8300","fSellPri":"884.7000","mSellPri":"884.7000","bankConversionPri":"878.6700","date":"2016-07-20","time":"18:20:03"},"data6":{"name":"澳大利亚元","fBuyPri":"497.6100","mBuyPri":"482.2300","fSellPri":"502.6100","mSellPri":"502.6100","bankConversionPri":"503.2000","date":"2016-07-20","time":"18:20:03"},"data7":{"name":"加拿大元","fBuyPri":"509.3700","mBuyPri":"493.6500","fSellPri":"513.4700","mSellPri":"513.4700","bankConversionPri":"513.7800","date":"2016-07-20","time":"18:20:03"},"data8":{"name":"泰国铢","fBuyPri":"18.9700","mBuyPri":"18.3900","fSellPri":"19.1300","mSellPri":"19.7100","bankConversionPri":"19.1100","date":"2016-07-20","time":"18:20:03"},"data9":{"name":"新加坡元","fBuyPri":"490.1000","mBuyPri":"474.9800","fSellPri":"493.5400","mSellPri":"493.5400","bankConversionPri":"494.8500","date":"2016-07-20","time":"18:20:03"},"data10":{"name":"瑞典克朗","fBuyPri":"77.2200","mBuyPri":"74.8400","fSellPri":"77.8400","mSellPri":"77.8400","bankConversionPri":"77.6200","date":"2016-07-20","time":"18:20:03"},"data11":{"name":"瑞士法郎","fBuyPri":"673.5000","mBuyPri":"652.7200","fSellPri":"678.2400","mSellPri":"678.2400","bankConversionPri":"680.0800","date":"2016-07-20","time":"18:20:03"},"data12":{"name":"丹麦克朗","fBuyPri":"98.3400","mBuyPri":"95.3000","fSellPri":"99.1200","mSellPri":"99.1200","bankConversionPri":"99.0700","date":"2016-07-20","time":"18:20:03"},"data13":{"name":"挪威克朗","fBuyPri":"78.2100","mBuyPri":"75.7900","fSellPri":"78.8300","mSellPri":"78.8300","bankConversionPri":"78.5500","date":"2016-07-20","time":"18:20:03"},"data14":{"name":"南非兰特","fBuyPri":"46.5700","mBuyPri":"43.0000","fSellPri":"46.8900","mSellPri":"50.4600","bankConversionPri":"46.7600","date":"2016-07-20","time":"18:20:03"},"data15":{"name":"卢布","fBuyPri":"10.4900","mBuyPri":"9.8500","fSellPri":"10.5700","mSellPri":"10.5700","bankConversionPri":"10.5500","date":"2016-07-20","time":"18:20:03"},"data16":{"name":"澳门元","fBuyPri":"83.4200","mBuyPri":"80.6200","fSellPri":"83.7400","mSellPri":"86.4200","bankConversionPri":"83.7900","date":"2016-07-20","time":"18:20:03"},"data17":{"name":"菲律宾比索","fBuyPri":"14.1100","mBuyPri":"13.6800","fSellPri":"14.2300","mSellPri":"14.6600","bankConversionPri":"14.2400","date":"2016-07-20","time":"18:20:03"},"data18":{"name":"新西兰元","fBuyPri":"468.4300","mBuyPri":"453.9800","fSellPri":"471.7300","mSellPri":"474.5500","bankConversionPri":"472.2000","date":"2016-07-20","time":"18:20:03"},"data19":{"name":"林吉特","fBuyPri":"166.1300","mBuyPri":"null","fSellPri":"167.2900","mSellPri":"null","bankConversionPri":"167.8100","date":"2016-07-20","time":"18:20:03"},"data20":{"name":"韩国元","fBuyPri":"0.5826","mBuyPri":"0.5621","fSellPri":"0.5872","mSellPri":"0.6086","bankConversionPri":"0.5872","date":"2016-07-20","time":"18:20:03"},"data21":{"name":"新台币","fBuyPri":"null","mBuyPri":"20.1200","fSellPri":"null","mSellPri":"21.5600","bankConversionPri":"20.9000","date":"2016-07-20","time":"18:20:03"}}],"error_code":0}
    

    前端不熟悉,求各位指教。

    5 条回复    2016-07-22 13:47:29 +08:00
    uuuing
        1
    uuuing  
    OP
       2016-07-20 23:12:07 +08:00
    有人吗?
    matthewgao
        2
    matthewgao  
       2016-07-20 23:31:48 +08:00
    没明白,什么叫怎么读取? JSON.parse()?
    jeremaihloo
        3
    jeremaihloo  
       2016-07-21 05:43:27 +08:00 via Android
    你要表达什么意思,什么叫读取?
    suduo1987
        4
    suduo1987  
       2016-07-21 13:01:34 +08:00
    var obj=JSON.parse('json');
    alert(obj.resultcode);
    uuuing
        5
    uuuing  
    OP
       2016-07-22 13:47:29 +08:00
    @matthewgao
    @jeremaihloo
    @suduo1987

    不好意思。。 已经搞定了。。 前端不太熟悉
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   3911 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 10:25 · PVG 18:25 · LAX 02:25 · JFK 05:25
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.