Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

jobject alternative in system.text.json


public class MyDTO
{
    public JsonElement ExtractedData {get;set;} = JsonExtensions.Null;
}

public static class JsonExtensions
{
    static readonly JsonElement nullElement = CreateNull();

    public static JsonElement Null => nullElement;

    static JsonElement CreateNull()
    {
        using var doc = JsonDocument.Parse("null");
        return doc.RootElement.Clone();
    }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #jobject #alternative
ADD COMMENT
Topic
Name
6+5 =