Closed utillity closed 1 year ago
The core handlebars.net engine does not know about JSON.NET or its special types like JValue, but https://github.com/Handlebars-Net/Handlebars.Net.Extension.NewtonsoftJson adds support. Try using that.
Or try using a JSON parsing method that produces POCOs and not the Newtonsoft-type structure.
thanks for the quick response! Deserializing to ExpandoObject
instead of Dynamic
works! Will see if the extension is of any use as well, thanks!
#if
does not work correctly with objects loaded from json, asautoRenew
is not aBoolean
but aJValue
.If I run this code, the
#if
statement works (ie. interpretsautoRenew
asBoolean
) correctly:output
But if I load the context from JSON, the
#if
block will not interpret the JValue asBoolean
and will return theELSE
block.Not working example
output
Any idea how I can fix this?