src/YL.Utils/Json/SwifterJson.cs
(完整代码) 783Busing Swifter.Json;
using Swifter.RW;
using YL.Utils.Extensions;
namespace YL.Utils.Json
{
public static class SwifterJson
{
public static string SwifterToJson<T>(this T obj)
{
return JsonFormatter.SerializeObject(obj);
}
public static string SwifterToJson<T>(this T obj, string dateTimeFormat, JsonFormatterOptions options = JsonFormatterOptions.Default)
{
var format = new JsonFormatter(options);
format.SetDateTimeFormat(dateTimeFormat.IsEmpty() ? DateTimeExt.DateTimeFormat : dateTimeFormat);
return format.Serialize(obj);
}
public static T SwifterToObj<T>(this string str)
{
return JsonFormatter.DeserializeObject<T>(str);
}
}
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。