Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect status is obtained when deserializing the result object #65

Closed
MrDave1999 opened this issue Mar 16, 2024 · 0 comments · Fixed by #67
Closed

Incorrect status is obtained when deserializing the result object #65

MrDave1999 opened this issue Mar 16, 2024 · 0 comments · Fixed by #67
Labels
bug Something isn't working

Comments

@MrDave1999
Copy link
Owner

Problem reproduction

public class Program
{
    public static void Main()
    {
        var options = new JsonSerializerOptions { PropertyNameCaseInsensitive = true };
        var json =
            """
            {
              "status": "Ok",
              "success": true,
              "message": "Operation successfully executed",
              "errors": []
            }
            """;

        Result result = JsonSerializer.Deserialize<Result>(json, options);
        Console.WriteLine(result.Status == ResultStatus.Ok); // Output: False
        Console.WriteLine(result.Status); // Output: Failure
    }
}
  • The expected behavior should be True.
  • The result status should not be Failure. Should be Ok in this case.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant