mirror of
https://github.com/bitwarden/server.git
synced 2025-07-02 00:22:50 -05:00
Start Migration from Newtonsoft.Json to System.Text.Json (#1803)
* Start switch to System.Text.Json * Work on switching to System.Text.Json * Main work on STJ refactor * Fix build errors * Run formatting * Delete unused file * Use legacy for two factor providers * Run formatter * Add TokenProviderTests * Run formatting * Fix merge issues * Switch to use JsonSerializer * Address PR feedback * Fix formatting * Ran formatter * Switch to async * Ensure Enums are serialized as strings * Fix formatting * Enqueue single items as arrays * Remove CreateAsync method on AzureQueueService
This commit is contained in:
@ -23,7 +23,6 @@ using Bit.Core.Settings;
|
||||
using IdentityModel;
|
||||
using Microsoft.AspNetCore.DataProtection;
|
||||
using MimeKit;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Bit.Core.Utilities
|
||||
{
|
||||
@ -332,12 +331,12 @@ namespace Bit.Core.Utilities
|
||||
|
||||
/// <summary>
|
||||
/// Creates a clone of the given object through serializing to json and deserializing.
|
||||
/// This method is subject to the limitations of Newstonsoft. For example, properties with
|
||||
/// This method is subject to the limitations of System.Text.Json. For example, properties with
|
||||
/// inaccessible setters will not be set.
|
||||
/// </summary>
|
||||
public static T CloneObject<T>(T obj)
|
||||
{
|
||||
return JsonConvert.DeserializeObject<T>(JsonConvert.SerializeObject(obj));
|
||||
return JsonSerializer.Deserialize<T>(JsonSerializer.Serialize(obj));
|
||||
}
|
||||
|
||||
public static bool SettingHasValue(string setting)
|
||||
|
Reference in New Issue
Block a user