JsonElement Parameter of valuekind undefined Error

Viewed 126

I am trying to create a HttpRequestMessage method in my ASP.NET MVC that takes a JSONElement. The problem is that whenever I try to make breakpoints in my code to check the JSONElement, it says that the parameter is of value kind= undefined:"".

The following is the JSON code that I am trying to pass:

{
        "Username": "Username",
        "Password": "Password"
}

And the following is the action method:

 [HttpGet]
        public HttpResponseMessage CheckingJson(JsonElement model)
        {
            try
            {
               return Request.CreateResponse(HttpStatusCode.OK,model.GetString());
            }
            catch (Exception ex)
            {
                return Request.CreateResponse(HttpStatusCode.NotFound, "NotFound");
            }

}
1 Answers

When Swagger tries to make example, this is happening. In my case, I installed the NewtonSoft.Json package, and I changed JsonElement to JObject.

Related