public string Serialize(IFoo <IBar <IBaz> > foo, Projection projection) { var converters = _jsonConvertersFactory.GetConvertersForProjection(projection); return(JsonConvert.SerializeObject( foo, new JsonSerializerSettings() { Formatting = Formatting.Indented, Converters = converters, ContractResolver = new CamelCasePropertyNamesContractResolver() } )); }
public string Serialize(IFoo <IBar <IBaz> > foo, Projection projection) { // using "None" projection as we still want the default converters var converters = _jsonConvertersFactory.GetConvertersForProjection(Projection.None); var contractResolver = _contractResolverFactory.GetContractResolver(projection); return(JsonConvert.SerializeObject( foo, new JsonSerializerSettings() { Formatting = Formatting.Indented, Converters = converters, ContractResolver = contractResolver } )); }