泛型解析不规则数组
Posted maja
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了泛型解析不规则数组相关的知识,希望对你有一定的参考价值。
1 { 2 "resultcode":"200", 3 "reason":"SUCCESSED!", 4 "result":[ 5 { 6 "data1":{ 7 "name":"英镑", /*货币名称*/ 8 "fBuyPri":"1001.430", /*现汇买入价*/ 9 "mBuyPri":"970.510", /*现钞买入价*/ 10 "fSellPri":"1009.480", /*现汇卖出价*/ 11 "mSellPri":"1009.480", /*现钞卖出价*/ 12 "bankConversionPri":"1014.870", /*银行折算价/中间价*/ 13 "date":"2012-12-13", /*发布日期*/ 14 "time":"16:25:49" /*发布时间*/ 15 }, 16 "data2":{ 17 "name":"港币", 18 "fBuyPri":"80.210", 19 "mBuyPri":"79.570", 20 "fSellPri":"80.520", 21 "mSellPri":"80.520", 22 "bankConversionPri":"81.140", 23 "date":"2012-12-13", 24 "time":"16:25:49" 25 }, 26 "data3":{ 27 "name":"美元", 28 "fBuyPri":"621.650", 29 "mBuyPri":"616.670", 30 "fSellPri":"624.150", 31 "mSellPri":"624.150", 32 "bankConversionPri":"628.870", 33 "date":"2012-12-13", 34 "time":"16:25:49" 35 }, 36 "data4":{ 37 "name":"瑞士法郎", 38 "fBuyPri":"670.310", 39 "mBuyPri":"649.620", 40 "fSellPri":"675.700", 41 "mSellPri":"675.700", 42 "bankConversionPri":"674.350", 43 "date":"2012-12-13", 44 "time":"16:25:49" 45 }, 46 "data5":{ 47 "name":"新加坡元", 48 "fBuyPri":"508.300", 49 "mBuyPri":"492.610", 50 "fSellPri":"512.390", 51 "mSellPri":"512.390", 52 "bankConversionPri":"512.000", 53 "date":"2012-12-13", 54 "time":"16:25:49" 55 }, 56 "data6":{ 57 "name":"瑞典克朗", 58 "fBuyPri":"93.340", 59 "mBuyPri":"90.450", 60 "fSellPri":"94.090", 61 "mSellPri":"94.090", 62 "bankConversionPri":"93.770", 63 "date":"2012-12-13", 64 "time":"16:25:49" 65 }, 66 "data7":{ 67 "name":"丹麦克朗", 68 "fBuyPri":"108.920", 69 "mBuyPri":"105.550", 70 "fSellPri":"109.790", 71 "mSellPri":"109.790", 72 "bankConversionPri":"109.430", 73 "date":"2012-12-13", 74 "time":"16:25:49" 75 }, 76 "data8":{ 77 "name":"挪威克朗", 78 "fBuyPri":"110.490", 79 "mBuyPri":"107.080", 80 "fSellPri":"111.380", 81 "mSellPri":"111.380", 82 "bankConversionPri":"111.060", 83 "date":"2012-12-13", 84 "time":"16:25:49" 85 }, 86 "data9":{ 87 "name":"日元", 88 "fBuyPri":"7.431", 89 "mBuyPri":"7.201", 90 "fSellPri":"7.483", 91 "mSellPri":"7.483", 92 "bankConversionPri":"7.531", 93 "date":"2012-12-13", 94 "time":"16:25:49" 95 }, 96 "data10":{ 97 "name":"加拿大元", 98 "fBuyPri":"630.950", 99 "mBuyPri":"611.470", 100 "fSellPri":"636.010", 101 "mSellPri":"636.010", 102 "bankConversionPri":"638.800", 103 "date":"2012-12-13", 104 "time":"16:25:49" 105 }, 106 "data11":{ 107 "name":"澳大利亚元", 108 "fBuyPri":"654.900", 109 "mBuyPri":"634.680", 110 "fSellPri":"660.160", 111 "mSellPri":"660.160", 112 "bankConversionPri":"663.300", 113 "date":"2012-12-13", 114 "time":"16:25:49" 115 }, 116 "data12":{ 117 "name":"欧元", 118 "fBuyPri":"812.520", 119 "mBuyPri":"787.430", 120 "fSellPri":"819.040", 121 "mSellPri":"819.040", 122 "bankConversionPri":"821.960", 123 "date":"2012-12-13", 124 "time":"16:25:49" 125 }, 126 "data13":{ 127 "name":"澳门元", 128 "fBuyPri":"77.910", 129 "mBuyPri":"75.300", 130 "fSellPri":"78.210", 131 "mSellPri":"80.720", 132 "bankConversionPri":"78.320", 133 "date":"2012-12-13", 134 "time":"16:25:49" 135 }, 136 "data14":{ 137 "name":"菲律宾比索", 138 "fBuyPri":"15.100", 139 "mBuyPri":"14.640", 140 "fSellPri":"15.220", 141 "mSellPri":"15.690", 142 "bankConversionPri":"15.220", 143 "date":"2012-12-13", 144 "time":"16:25:49" 145 }, 146 "data15":{ 147 "name":"泰国铢", 148 "fBuyPri":"20.240", 149 "mBuyPri":"19.620", 150 "fSellPri":"20.400", 151 "mSellPri":"21.030", 152 "bankConversionPri":"20.390", 153 "date":"2012-12-13", 154 "time":"16:25:49" 155 }, 156 "data16":{ 157 "name":"新西兰元", 158 "fBuyPri":"524.400", 159 "mBuyPri":"0.000", 160 "fSellPri":"528.610", 161 "mSellPri":"0.000", 162 "bankConversionPri":"526.770", 163 "date":"2012-12-13", 164 "time":"16:25:49" 165 }, 166 "data17":{ 167 "name":"韩国元", 168 "fBuyPri":"0.000", 169 "mBuyPri":"0.560", 170 "fSellPri":"0.000", 171 "mSellPri":"0.608", 172 "bankConversionPri":"0.586", 173 "date":"2012-12-13", 174 "time":"16:25:49" 175 } 176 } 177 ] 178 }
不规则的json数组 解析
1、首先需要序列化 dynamic
2、遍历 List<dynamic>
3、遍历 data1、data2
data.Value.name
以上是关于泛型解析不规则数组的主要内容,如果未能解决你的问题,请参考以下文章