Using reflection, I'm able to filter members based on whether they are inherited, declared, public, private, etc. Is there any way to do the same sort of filtering when serializing an object using JSon.NET?
My code is currently:
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
public void addRequestParameters<T>(string key, T SerializableRequestParameters)
{
//Serialize the object
string json = JsonConvert.SerializeObject(SerializableRequestParameters, new JsonSerializerSettings
{
TypeNameHandling = TypeNameHandling.All,
ReferenceLoopHandling = ReferenceLoopHandling.Ignore
});
//Add it to an existing request (unrelated to this question)
((JObject)JSONRequest).Add(key, JToken.Parse(json));
}