jellyfin-server/MediaBrowser.Api/HttpHandlers/JsonHandler.cs
2012-08-11 14:07:07 -04:00

21 lines
562 B
C#

using System.IO;
using System.Threading.Tasks;
using MediaBrowser.Common.Net.Handlers;
using MediaBrowser.Common.Serialization;
namespace MediaBrowser.Api.HttpHandlers
{
public abstract class JsonHandler : BaseJsonHandler
{
protected abstract object ObjectToSerialize { get; }
protected override Task WriteResponseToOutputStream(Stream stream)
{
return Task.Run(() =>
{
JsonSerializer.SerializeToStream(ObjectToSerialize, stream);
});
}
}
}