码迷,mamicode.com
首页 > Web开发 > 详细

System.Json 使用注意

时间:2014-07-26 01:35:46      阅读:260      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   使用   os   re   c   问题   

  在xamarin中对json字符串进行解析,使用System.Json时出现怪问题:

 json-string = { "ret" : "OK" }

使用如下代码解析:

        /// <summary>解析 : { "ret":"xxxxx" } 
        /// </summary>
        /// <param name="jsonStr"></param>
        /// <returns></returns>
        private string getReturnFromJson(string jsonStr)
        {
            JsonValue jv = JsonObject.Parse(jsonStr);
            return jv["ret"].ToString();
        }

  时,获得的结果总是:"OK" ,而不是 OK ,也就是说结果字符串中本不应该再有双引号的。后来去掉 ToString() 后结果就对了,真奇怪! 记录一下。

System.Json 使用注意,布布扣,bubuko.com

System.Json 使用注意

标签:style   blog   color   使用   os   re   c   问题   

原文地址:http://www.cnblogs.com/csu8263/p/3869140.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!