StubbleOrg / Stubble

Trimmed down {{mustache}} templates in .NET
Other
406 stars 58 forks source link

How support dynamic type in view value #30

Closed cipchk closed 6 years ago

cipchk commented 6 years ago

the example code:

var data = JsonConvert.DeserializeObject("{ \"name\": \"test\" }");
var tpl = "My name is: {{name}}";

var stubble = new StubbleBuilder().Build();
var res = stubble.Render(tpl, data);

I expected value:

My name is: test

But just only:

My name is: 
Romanx commented 6 years ago

Hi @cipchk,

JObjects are a special case of dynamic which is handled separately from the main library. If you install the Stubble.Extensions.JsonNet library then that should work with only a minor change to the builder.

Let me know if you have any other questions.

cipchk commented 6 years ago

Hi @Romanx,

I solved the problem via Stubble.Extensions.JsonNet, thank you very much about your work.