You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public class TestResutDto:EntityDto
{
public DateTime TestDate { get; set; }
public IEnumerable<ISubItem> SubItems { get; set; }
}
public interface ISubItem
{
public int Prop1 { get; set; }
public bool Prop2 { get; set; }
}
public class SubItemModel1 : ISubItem
{
public int Prop1 { get; set; }
public bool Prop2 { get; set; }
public int PropModel1Prop1 { get; set; }
public bool PropModel1Prop2 { get; set; }
}
public class SubItemModel2 : ISubItem
{
public int Prop1 { get; set; }
public bool Prop2 { get; set; }
public int PropModel2Prop1 { get; set; }
public bool PropModel2Prop2 { get; set; }
}
And this call in my AppService method:
public TestResutDto TestMethod()
{
var result = new TestResutDto
{
Id = 1,
TestDate = DateTime.Now,
SubItems = new ISubItem[] {
new SubItemModel1 {
Prop1 = 1,
Prop2 = true,
PropModel1Prop1 = 100,
PropModel1Prop2 = false
},
new SubItemModel2 {
Prop1 = 2,
Prop2 = false,
PropModel2Prop1 = 200,
PropModel2Prop2 = true
}
}
};
return result;
}
I try to switch to Microsoft SystemTextJson in MVC app using this configurations:
Hi,
Related to this #6884 I have create different branch with this issue https://github.com/totpero/aspnetboilerplate-demo/tree/text-json
I have this demo classes structure:
And this call in my AppService method:
I try to switch to Microsoft SystemTextJson in MVC app using this configurations:
The output json result when I call this method in js is:
There are missing the implementation class properties. The SystemTextJson return only the Intefrace properties.
If I switch to the old NewtonsoftJson configurations like this:
the json result is:
How to maintain the same behavior like NewtonsoftJson in Microsoft SystemTextJson migration?
Thanks
The text was updated successfully, but these errors were encountered: