internal ApiClient(bool isSecure, string baseAddress, Dictionary <string, string> headers) { this.isSecure = isSecure; this.headers = headers; this.baseAddress = baseAddress; this.serializerException = new Serialization.JsonSerializer <Exceptions.VoucherifyClientException>(); }
static void JsonExperiments() { NoSqlWrapper.Serialization.JsonSerializer <SimplePoco> serial = new Serialization.JsonSerializer <SimplePoco>(); var settings = new JsonSerializerSettings(); settings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore; //settings.Error = new EventHandler<Newtonsoft.Json.Serialization.ErrorEventArgs>(JsonErrors); settings.MissingMemberHandling = MissingMemberHandling.Error; settings.TypeNameHandling = TypeNameHandling.All; //serial.JsonSettings = new JsonSerializerSettings(); serial.Options = new Conventions.Options(); var one = BuildMeOne(); var oneJson = serial.Serialize(one); var somejson = "{'SimplePocoId':1888,'RootName':'Rooty','Children':[{'ChildName':'Childey'}]}"; var someJsonResult = serial.Deserialize(somejson); var someMoreJson = "{'$type':'NoSqlWrapper.TestHarness.SimplePoco, NoSqlWrapper.TestHarness.Console','SimplePocoId':1888,'RootName':'Rooty','Children':{'$type':'NoSqlWrapper.TestHarness.SimplePocoChildList, NoSqlWrapper.TestHarness.Console','$values':[{'$type':'NoSqlWrapper.TestHarness.SimplePocoChild, NoSqlWrapper.TestHarness.Console','ChildName':'Childey','Something':{'$type':'NoSqlWrapper.TestHarness.BSomething, NoSqlWrapper.TestHarness.Console','BSome':'9c10755d-7caf-4fab-a716-754fe88bacb9','Amount':333.0}}]}}"; var someMoreJsonResult = serial.Deserialize(someMoreJson); var dd = 23; Console.ReadKey(); }
protected override IJsonSerializer CreateErrorSerializer() { var serializer = new Serialization.JsonSerializer(); serializer.Settings.ContractResolver.ObjectContract = new RequiredAttributesObjectContract(RequiredLevel.AllowNull); serializer.Settings.MissingMemberHandling = MissingMemberHandling.Error; return(serializer); }
internal ApiClient(bool isSecure, string hostAddress, string basePath, int?port, Dictionary <string, string> headers, List <JsonConverter> converters) { this.isSecure = isSecure; this.headers = headers; this.hostAddress = hostAddress; this.basePath = string.IsNullOrEmpty(basePath) ? string.Empty : basePath; this.port = port; this.converters = converters; this.serializerException = new Serialization.JsonSerializer <Exceptions.VoucherifyClientException>(converters); }
public IObservable <List <ICountry> > Execute() { string json = Resources.CountriesJson; var countries = new Serialization .JsonSerializer() .Deserialize <List <Country> >(json) .OrderBy(country => country.Name) .ToList <ICountry>(); return(Observable.Return(countries)); }
static SerializerFactory() { jsonSerializer = new Serialization.JsonSerializer(); xmlSerializer = new Serialization.XmlSerializer(); }