Litjson.dll:
using System.Text.RegularExpressions;
using System.Collections.Generic;
using LitJson;
//json读取解析成 类 。
类 skill001 = JsonMapper.ToObject<player>(File.ReadAllText("json技能信息.json"));
//把 类 生成json格式的string
string json = JsonMapper.ToJson(skill001); //中文字符会变成\u乱码,使用下面方法解决乱码问题
//此方法可以把string里所有 \u乱码转换成中文
public static string Unicode2String(string source)//把字符串里的乱码转换成中文
{
return new Regex(@"\\u([0-9A-F]{4})", RegexOptions.IgnoreCase | RegexOptions.Compiled).Replace(
source, x => string.Empty + Convert.ToChar(Convert.ToUInt16(x.Result("$1"), 16)));
}
关于报错: