本文主要是介绍flurl升级之后没有FlurlNewtonsoftJsonSerializer,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
新建NewtonsoftJsonSerializer.cs
/// <summary>
/// ISerializer implementation based on Newtonsoft.Json.
/// Default serializer used in calls to GetJsonAsync, PostJsonAsync, etc.
/// </summary>
public class NewtonsoftJsonSerializer : IJsonSerializer
{private readonly JsonSerializerSettings _settings;/// <summary>/// Initializes a new instance of the <see cref="NewtonsoftJsonSerializer"/> class./// </summary>/// <param name="settings">Settings to control (de)serialization behavior.</param>public NewtonsoftJsonSerializer(JsonSerializerSettings settings = null) {_settings = settings;}public string Serialize(object obj, Type type){return JsonConvert.SerializeObject(obj, _settings);}public object Deserialize(string json, Type type){return JsonConvert.DeserializeObject(json,type, _settings);}
}
代码修改为下面的即可
这篇关于flurl升级之后没有FlurlNewtonsoftJsonSerializer的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!