Create overload for `ToJson()` with Formatting param

This commit is contained in:
Bogdan 2023-06-20 07:42:54 +03:00 committed by Mark McDowall
parent 5c48049702
commit aa2b003167
1 changed files with 5 additions and 0 deletions

View File

@ -121,6 +121,11 @@ namespace NzbDrone.Common.Serializer
return JsonConvert.SerializeObject(obj, SerializerSettings); return JsonConvert.SerializeObject(obj, SerializerSettings);
} }
public static string ToJson(this object obj, Formatting formatting)
{
return JsonConvert.SerializeObject(obj, formatting, SerializerSettings);
}
public static void Serialize<TModel>(TModel model, TextWriter outputStream) public static void Serialize<TModel>(TModel model, TextWriter outputStream)
{ {
var jsonTextWriter = new JsonTextWriter(outputStream); var jsonTextWriter = new JsonTextWriter(outputStream);