With Newtonsoft Json you can convert an object to a JObject
by calling JObject.FromObject(object)
.
Is there a counterpart in System.Text.Json to get a JsonDocument
from an object?
There is an open issue for it.
But now there is no such methods. You can try
using (JsonDocument document = JsonDocument.Parse(JsonSerializer.Serialize(object)))
{
...
}
One more issue
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With