日期:2014-05-17  浏览次数:20351 次

这段json代码怎么改
 var jsonText = "{\"result\":\"success\",\"return\":{\"high\":{\"value\":\"46.50000\",\"value_int\":\"4650000\",\"display\":\"$46.50000\",\"display_short\":\"$46.50\",\"currency\":\"USD\"},\"low\":{\"value\":\"41.02000\",\"value_int\":\"4102000\",\"display\":\"$41.02000\",\"display_short\":\"$41.02\",\"currency\":\"USD\"}}}";Response.Write(FromJson(jsonText)); public string FromJson(string json)
        {
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            Dictionary<string, object> jsons = (Dictionary<string, object>)serializer.DeserializeObject(json);
            object value1;
            object value2;
            object sucess;
            string result = string.Empty;
            if (jsons.TryGetValue("return", out sucess))
            {
                Dictionary<string, object> jsontemple = (Dictionary<string, object>)sucess;
               // jsontemple.TryGetValue("low", out value1);
                foreach (KeyValuePair<string, object> pair2 in jsontemple)
                {
                    Dictionary<string, object> jsontemple2 = (Dictionary<string, object>)pair2.Value;
                    jsontemple2.TryGetValue("value", out value1);
                    jsontemple2.TryGetValue("value_int", out value2);
                    Response.Write(value1 + "__" + value2);
                    break;
                }
            }
            else
            {
                result = string.Empty;
            }
            return result;
        }


怎么改输出指定的low的value呢,谢谢

------解决方案-------