This commit is contained in:
lzw
2021-11-03 21:14:58 +08:00
parent eb51c3c755
commit 6f79f870bb
7 changed files with 26 additions and 14 deletions

View File

@@ -6,6 +6,17 @@ namespace Yi.Framework.Common.Helper
{
public class JsonHelper
{
public static string ObjToStr<T>(T obj)
{
return Newtonsoft.Json.JsonConvert.SerializeObject(obj);
}
public static T StrToObj<T>(string str)
{
return Newtonsoft.Json.JsonConvert.DeserializeObject<T>(str);
}
/// <summary>
/// 转换对象为JSON格式数据
/// </summary>