Json Prasing issue in >NEt core compare to .Net Framwork

I am Migrating the web API build in .NET framework to .NET core.
while migrating I am facing parsing issue which was handle in .NET framework while JSON parsing in API controller.
For E.g I am having a class Test with below properties

  1. Public bool IsValid{get; set;}
  2. public int YearId { get; set; }
    case 1
    while calling API in JSON If IsValid value is passed as null then in .NET framework it is getting parsed however not in .NET core 3.1 it is giving error as “Error converting value {null} to type ‘System.Boolean’.”.
    Also I tried with NullValueHandling to Ignore as globally in configure service but it removes property which are null while sending the response.
    case 2
    while calling API in JSON If YearId value is passed as 0 then in .NET framework it is getting parsed however not in .NET core 3.1.

Can some please help me for this.

Did you solve this? I also have the same case…

No we have made the changes in UI side to set the default values.
Still I am confused how it was working in dotnet framework.

thanks for the awesome information.

.NET Foundation Website | Blog | Projects | Code of Conduct