C# JObject将json字符串转为json对象

static void Main(string[] args)
        {
            string json = "{\"name\": \"测试\",\"mobile\": \"15341234699\",\"city\": {\"province\": \"内蒙古自治区\",\"city\": \"呼和浩特市\",\"xian\": \"玉泉区\" },\"address\": \"255466\" }";
            JObject jo = (JObject)JsonConvert.DeserializeObject(json.ToString());
            foreach (var item in jo)
            {
                Console.WriteLine($"{item.Key}:{item.Value}");
            }
            Console.WriteLine("Hello World!");
            Console.ReadKey();
        }

  

 



报红线自己记得添加相应的引用与nuget包

posted @ 2018-11-07 10:09  LBO.net  阅读(5073)  评论(2编辑  收藏  举报
//返回顶部