mustache-sharp icon indicating copy to clipboard operation
mustache-sharp copied to clipboard

IF does not work when using JOject

Open alexknott opened this issue 6 years ago • 3 comments

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.

alexknott avatar Jan 28 '19 08:01 alexknott

I'm facing the same problem right now

Redmaro84 avatar Apr 23 '19 09:04 Redmaro84

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 avatar May 23 '19 20:05 ericnewton76

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

ericnewton76 avatar May 23 '19 20:05 ericnewton76