基本信息
源码名称:C#的JSON解析 示例
源码大小:0.02M
文件格式:.7z
开发语言:C#
更新时间:2017-07-19
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 2 元 
   源码介绍

C#的JSON解析

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;

namespace JsonUtils
{
    class Program
    {
        static void Main(string[] args)
        {
            WebClient client = new WebClient();
            string json = @"{""errNo"":""0"", data : { ""31"": { ""content"": { ""week"": ""周三"" , ""city"": ""上海"" , ""today"": { ""condition"": ""多云"" , ""temp"": ""35~28℃"" , ""wind"": ""南风3-4级"" , ""imgs"": [ ""a1"" , ""a1"" ] , ""img"": [ ""http:\/\/open.baidu.com\/stat\/weather\/newday\/01.gif"" , ""http:\/\/open.baidu.com\/stat\/weather\/newnight\/01.gif"" ] , ""link"": ""http:\/\/www.weather.com.cn\/html\/weather\/101020100.shtml"" , ""pm25"": ""76"" , ""pollution"": ""10"" , ""pm25url"": ""http:\/\/www.baidu.com\/s?wd=%E4%B8%8A%E6%B5%B7%E7%A9%BA%E6%B0%94%E8%B4%A8%E9%87%8F%E6%8C%87%E6%95%B0"" , ""pmdate"": false } , ""tomorrow"": { ""condition"": ""多云转阵雨"" , ""temp"": ""36~27℃"" , ""wind"": ""南风3-4级"" , ""imgs"": [ ""a1"" , ""a1"" ] , ""img"": [ ""http:\/\/open.baidu.com\/stat\/weather\/newday\/01.gif"" , """" ] , ""link"": ""http:\/\/www.weather.com.cn\/html\/weather\/101020100.shtml"" , ""pm25"": ""76"" , ""pollution"": ""10"" , ""pm25url"": ""http:\/\/www.baidu.com\/s?wd=%E4%B8%8A%E6%B5%B7%E7%A9%BA%E6%B0%94%E8%B4%A8%E9%87%8F%E6%8C%87%E6%95%B0"" , ""pmdate"": false } , ""thirdday"": { ""condition"": ""阵雨转阴"" , ""temp"": ""32~24℃"" , ""wind"": ""北风3-4级"" , ""imgs"": [ ""a3"" , ""a1"" ] , ""img"": [ ""http:\/\/open.baidu.com\/stat\/weather\/newday\/03.gif"" , """" ] , ""link"": ""http:\/\/www.weather.com.cn\/html\/weather\/101020100.shtml"" , ""pm25"": ""76"" , ""pollution"": ""10"" , ""pm25url"": ""http:\/\/www.baidu.com\/s?wd=%E4%B8%8A%E6%B5%B7%E7%A9%BA%E6%B0%94%E8%B4%A8%E9%87%8F%E6%8C%87%E6%95%B0"" , ""pmdate"": false } , ""linkseven"": ""http:\/\/www.weather.com.cn\/html\/weather\/101020100.shtml#7d"" , ""source"": { ""name"": ""中国气象频道"" , ""url"": ""http:\/\/www.mywtv.cn\/"" } , ""cityname"": ""上海"" , ""ipcity"": ""上海"" , ""ipprovince"": ""上海"" , ""isauto"": true } , ""setting"": ""自动"" } } }";

            JsonObject value = JsonObject.Parse(json);

            Console.Write(value["data"]["31"]["content"]["thirdday"]["img"][0].Text());
            Console.Read();
            
        }
    }
}