//需要引用附件dll
TextReader reader = File.OpenText("json.txt");
JsonReader readerJson = new JsonTextReader(reader);
Dictionary
效果图:
五月花学校,软件开发培训,十六年办学经验
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Json;
using System.IO;
using System.Text.RegularExpressions;
using System.Web.Script.Serialization;
namespace PublicUse.Text
{
public class JsonSerz
{
public JsonSerz()
{
}
///
/// json序列化(非二进制方式)
///
///
///
///
public static string JsonSerializer
{
JavaScriptSerializer jsonSerialize = new JavaScriptSerializer();
return jsonSerialize.Serialize(t);
}
///
/// json反序列化(非二进制方式)
///
///
///
///
public static T JsonDeserialize
{
JavaScriptSerializer jsonSerialize = new JavaScriptSerializer();
return (T)jsonSerialize.Deserialize
}
}
}
告你个办法把,建好这个模型的对象,然后直接用jsonSerialize.Deserialize反解析到类型中就行了
Newtonsoft.Json