尝试反序列化 JSON 对象时收到此错误消息
错误信息
+
未为字符串“JPY:”和类型定义运算符Dictionary(Of String,Object)
。
这是我试图反序列化的 json 对象
{“JPY”:{“7d”:“6510.92”,“30d”:“4434.76”,“24h”:“7027.46”},“USD”:{“7d”:“65.09”,“30d”:“48.77” ", "24h": "74.26"}, "AUD": {"7d": "64.99", "30d": "49.10", "24h": "71.91"}, "CHF": {"7d": “66.86”、“30d”:“58.14”、“24h”:“69.57”}、“RUB”:{“7d”:“1896.79”、“30d”:“1472.11”、“24h”:“2206.51”} ,“时间戳”:1364257203,“THB”:{“30d”:“1100.31”},“CNY”:{“7d”:“417.58”,“30d”:“324.35”,“24h”:“466。92"},"SLL":{"7d":"16719.16","30d":"11865.62","24h":"19185.45"},"DKK":{"7d":"388.47","30d" :“350.27”,“24h”:“436.34”},“BRL”:{“7d”:“166.21”,“30d”:“106.56”,“24h”:“182.34”},“ILS”:{“ 7d:“236.79”,“30d”:“218.19”,“24h”:“259.00”},“GBP”:{“7d”:“44.16”,“30d”:“31.73”,“24h”:“ 49.22"}, "NZD": {"7d": "80.21", "30d": "59.29", "24h": "88.60"}, "PLN": {"7d": "218.66", "30d" :“163.68”、“24h”:“249.94”}、“CAD”:{“7d”:“68.76”、“30d”:“50.16”、“24h”:“76.43”}、“SEK”:{“7d” ":"445.63","30d":"315.11","24h":"510.58"},"SGD":{"7d":"87.88","30d":"61.97","24h":"93.35 "}, "HKD": {"7d": "550.10", "30d": "396.68", "24h": "571.82"}, "EUR": {"7d": "51.85", "30d": "38.65", "24h": "58.69"}}76.43"}, "SEK": {"7d": "445.63", "30d": "315.11", "24h": "510.58"}, "SGD": {"7d": "87.88", "30d" : "61.97", "24h": "93.35"}, "HKD": {"7d": "550.10", "30d": "396.68", "24h": "571.82"}, "EUR": {" 7d”:“51.85”,“30d”:“38.65”,“24h”:“58.69”}}76.43"}, "SEK": {"7d": "445.63", "30d": "315.11", "24h": "510.58"}, "SGD": {"7d": "87.88", "30d" : "61.97", "24h": "93.35"}, "HKD": {"7d": "550.10", "30d": "396.68", "24h": "571.82"}, "EUR": {" 7d”:“51.85”,“30d”:“38.65”,“24h”:“58.69”}}30d:“396.68”,“24h”:“571.82”},“EUR”:{“7d”:“51.85”,“30d”:“38.65”,“24h”:“58.69”}}30d:“396.68”,“24h”:“571.82”},“EUR”:{“7d”:“51.85”,“30d”:“38.65”,“24h”:“58.69”}}
这是我的代码
Dim js As New System.Web.Script.Serialization.JavaScriptSerializer
Dim testObj = js.Deserialize(rt, New Object().GetType())
out = "JPY: " + testObj("JPY") + Environment.NewLine
out += "7days: " + testObj("7d") + Environment.NewLine
out += "30days: " + testObj("30d") + Environment.NewLine
out += "24hours: " + testObj("24h")