Base solution for your next web application
Open Closed

True/false values instead of "true"/"false" strings #11674


User avatar
0
npdevs created

Hello.

Is it possible to force the UI (both mvc and angular) to send true/false values instead of strings ("true"/"false")? And *null *instead of "" (empty string) for null values? System.Text.Json serializer requires this.

Thanks.


3 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @npdevs

    I just checked the tenant settings page on Angular app and it sends true to server when you update settings. Could you tell me where did you see the "true"string ?

    Could you also share a sample case for the null value ?

  • User Avatar
    0
    npdevs created

    Hello,

    About the second case. When opening Administration/Users page, UI sends GetUsersInput:

    {"filter":"","permissions":[],"role":"","onlyLockedUsers":false,"maxResultCount":10,"skipCount":0}

    public class GetUsersInput : PagedAndSortedInputDto, IShouldNormalize, IGetUsersInput
    {
        ...
        public int? Role { get; set; }
        ...
    }
    

    Looks like Newtonsoft.Json serializer allows using empty strings as null values, but System.Text.Json serializer doesn't. I found a workaround for this case, but it's better to have a native solution.

    Thanks.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @npdevs

    We are working on migrating to System.Text.Json and I assume it will be completed with .NET 8 upgrade.