c# system.text.json serialize new {} code example Example: c# json serialize string jsonString = JsonSerializer.Serialize(weatherForecast);