I am passing a JSON payload to an API Controller, and one of the fields is dynamic because the field needs to be passed again as a JSON string to another API. The dotnet co
I had the same problem and I fixed it this way
using System.Text.Json;
string serializedObject = JsonSerializer.Serialize(x.Action); //Instead of use JsonConvert.SerializeObject(x.Action);
Instead of Newtonsoft.Json
you have to use System.Text.Json
.
Try this
var jsonString=s.Action.ToString();
This will give you the json string