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?
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
 
    
    As of .NET 6.0 (comes with System.Text.Json 6.0.0), JsonSerializer.SerializeToDocument is available.
JsonDocument doc = JsonSerializer.SerializeToDocument(yourObject);
