Removed Newtonsoft

This commit is contained in:
barelyprofessional
2026-01-02 18:56:22 -06:00
parent 289d2c91a3
commit 9bb9ca63a7
2 changed files with 6 additions and 33 deletions

View File

@@ -1,7 +1,6 @@
using System.Text;
using System.Text.RegularExpressions;
using KfChatDotNetBot.Models.DbModels;
using Newtonsoft.Json;
namespace KfChatDotNetBot.Extensions;
@@ -138,30 +137,4 @@ public static class Extensions
{
return $"@{user.KfUsername}";
}
/// <summary>
/// Deserialize a JSON string to the specified type using Newtonsoft.Json
/// </summary>
/// <typeparam name="T">Type to deserialize to</typeparam>
/// <param name="jsonString">JSON string to deserialize</param>
/// <returns>Deserialized object or null if string is null/empty</returns>
public static T? JsonDeserialize<T>(this string? jsonString) where T : class
{
if (string.IsNullOrEmpty(jsonString))
{
return null;
}
return JsonConvert.DeserializeObject<T>(jsonString);
}
/// <summary>
/// Serialize an object to JSON string using Newtonsoft.Json
/// </summary>
/// <param name="obj">Object to serialize</param>
/// <returns>JSON string representation</returns>
public static string JsonSerialize(this object obj)
{
return JsonConvert.SerializeObject(obj, Formatting.Indented);
}
}