You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have some complex class with properties of Dictionary type:
var some = new ComplexObject { Id = 1, AdditionalData = new Dictionary<string, SubObject>{ {"Test", new SubObject{ Property1 = "Some" } } };
var parser = new FluidParser();
if (_parser.TryParse(template, out var fluidTemplate, out var error))
{
var context = new TemplateContext(some);
return fluidTemplate.Render(context);
}
else
{
throw new Exception(error);
}
How can I access the inner SubObject? I've tried template like this:
{% if AdditionalData["Test"] %}
there is additional data: {{ AdditionalData.size}}
{% if AdditionalData["Test"].Property1 %}
Property1: {{ AdditionalData["Test"].Property1 }}
{% endif %}
{% endif %}
It rendered as:
there is additional data: 1
so AdditionalData["Test"].Property1 is nil.
Is this by design?
The text was updated successfully, but these errors were encountered:
I have some complex class with properties of Dictionary type:
How can I access the inner SubObject? I've tried template like this:
It rendered as:
so
AdditionalData["Test"].Property1
is nil.Is this by design?
The text was updated successfully, but these errors were encountered: