C#C
C#2y ago
114 replies
The Fog from Human Resources

Create JSON objects from System.Text.Json

For a while now I've been trying to get away from dependencies that I don't need anymore, including Newtonsoft.Json, however now I have the following issue:
How could I create a JSON object like this
{
    "key": {
        "key2":391648,
        "key3": [true, false, true] 
    } 

}

Usually I would have used JObject but that is no longer an option, so what's the equivalent in System.Text.Json (at best without creating a whole new Object / Class for the model)
Was this page helpful?