Skip to content

peeveen/SystemTextJsonDynamicConverter

Repository files navigation

System.Text.Json Dynamic Converter

Deserialize data into a dynamic type when using System.Text.Json.

Usage

class MyClass {

	... etc ...

	[JsonInclude]
	[System.Text.Json.Serialization.JsonConverter(typeof(SystemTextJson.DynamicConverter.Converter))]
	public dynamic MyDynamicData { get; set; }

	... etc ...

}

var result = JsonSerializer.Deserialize<MyClass>(json);
var val = result.MyDynamicData.some._dynamic.property.somewhere;

Alternatively ...

services.AddControllers().AddJsonOptions(options =>
	options.JsonSerializerOptions.Converters.Add(new SystemTextJson.DynamicConverter.Converter())
);

About

Dynamic converter for System.Text.Json

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages