public void Does_deserialize_int_objects() { JsConfig.TryToParsePrimitiveTypeValues = true; var dto = new TypeWithObjects { Value = 1, Map = new Dictionary <string, object> { { "string", "foo" }, { "int", 1 }, }, List = new List <object> { "foo", 1 } }; var json = dto.ToJson(); Assert.That(json, Is.EqualTo("{\"Value\":1,\"Map\":{\"string\":\"foo\",\"int\":1},\"List\":[\"foo\",1]}")); var fromJson = json.FromJson <TypeWithObjects>(); Assert.That(fromJson.Value, Is.EqualTo(1)); Assert.That(fromJson.Map["int"], Is.EqualTo(1)); Assert.That(fromJson.List[1], Is.EqualTo(1)); JsConfig.Reset(); }
public void Does_deserialize_int_objects() { JsConfig.TryToParsePrimitiveTypeValues = true; var dto = new TypeWithObjects { Value = 1, Map = new Dictionary<string, object> { {"string", "foo"}, {"int", 1}, }, List = new List<object> { "foo", 1 } }; var json = dto.ToJson(); Assert.That(json, Is.EqualTo("{\"Value\":1,\"Map\":{\"string\":\"foo\",\"int\":1},\"List\":[\"foo\",1]}")); var fromJson = json.FromJson<TypeWithObjects>(); Assert.That(fromJson.Value, Is.EqualTo(1)); Assert.That(fromJson.Map["int"], Is.EqualTo(1)); Assert.That(fromJson.List[1], Is.EqualTo(1)); JsConfig.Reset(); }