ASP.NET Core 3.0 [FromBody] string content returns "The JSON value could not be converted to System.String."

Not sure this help but I think they made some change in .net core 3.0 Newtonsoft.JSON package so you can try this

Install Microsoft.AspNetCore.Mvc.NewtonsoftJson package.

In your startup.cs add


If you are using core 3.0 then this has built-in JSON support. I have use the following and it works without setting the custom input handler.

public async Task<IActionResult> Index([FromBody] JsonElement body)

    string json = System.Text.Json.JsonSerializer.Serialize(body);
    return Ok();


Change [FromBody] string content to [FromBody] object content and then if you want/need to read as string use content.ToString()