Skip to content

Instantly share code, notes, and snippets.

@lenkan
Created October 30, 2016 14:20
Show Gist options
  • Save lenkan/db28050fe8653890ac93e9f2ace7ba03 to your computer and use it in GitHub Desktop.
Save lenkan/db28050fe8653890ac93e9f2ace7ba03 to your computer and use it in GitHub Desktop.
A System.Net.Http.HttpContent for json data
using System.Net.Http;
using System.Text;
using Newtonsoft.Json;
namespace Lenkan.StrengthLog.Data.Couch
{
public class JsonContent : StringContent
{
public JsonContent(string s) : base(s, Encoding.UTF8, "application/json")
{ }
public JsonContent(object o) : this(JsonConvert.SerializeObject(o))
{ }
}
}
@imzjy
Copy link

imzjy commented Sep 22, 2018

works perfect! thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment