jehugaleahsa / mustache-sharp

An extension of the mustache text template engine for .NET.
The Unlicense
306 stars 80 forks source link

IF does not work when using JOject #89

Open alexknott opened 5 years ago

alexknott commented 5 years ago

When passing a JOBject in to Generator.Render the IF clause does not get evaluated. The ability to pass JObect to render is really useful because it allows us to pass dynamic data payloads without concrete mapping.

Redmaro84 commented 5 years ago

I'm facing the same problem right now

ericnewton76 commented 5 years ago

Unfortunately this would cause a hard dependency on Newtonsoft Json net.

Have you considered converting JObject to a dynamic, eventually getting an actual System.Dynamic.ExpandoObject? I don't specifically remember exactly what to do but the JSON Net library can make that conversion. I believe it might flatten the hierarchy though.

ericnewton76 commented 5 years ago

Sorry, I just realized #78 will prevent you from using dynamic/Expando since the library doesn't understand dynamic objects.