-
Notifications
You must be signed in to change notification settings - Fork 11
System.Text.Json support
JPVenson edited this page May 19, 2022
·
1 revision
Morestachio supports the direct access to the JsonDocument and JsonElement types. Using the nuget package, you can enable IValueConverter
by calling the extension method WithSystemTextJsonValueResolver
on any IParserOptionsBuilder
like this:
var document = await ParserOptionsBuilder.New()
.WithSystemTextJsonValueResolver()
...
.BuildAndParseAsync();
The template can now access any Json document directly like this:
var jsonDocument = System.Text.Json.JsonDocument.Parse(jsonText);
document.CreateRenderer().RenderAndStringify(jsonDocument);