A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/Handlebars-Net/Handlebars.Net.Extension.NewtonsoftJson below:

Handlebars-Net/Handlebars.Net.Extension.NewtonsoftJson: Newtonsoft.Json extension for Handlebars.Net

Handlebars.Net.Extension.NewtonsoftJson

Adds proper Newtonsoft.Json support to Handlebars.Net

dotnet add package Handlebars.Net.Extension.NewtonsoftJson
var handlebars = Handlebars.Create();
handlebars.Configuration.UseNewtonsoftJson();
[Fact]
public void JsonTestObjects()
{
    var model = JObject.Parse("{\"Key1\": \"Val1\", \"Key2\": \"Val2\"}");

    var source = "{{#each this}}{{@key}}{{@value}}{{/each}}";

    var handlebars = Handlebars.Create();
    handlebars.Configuration.UseNewtonsoftJson();

    var template = handlebars.Compile(source);

    var output = template(model);

    Assert.Equal("Key1Val1Key2Val2", output);
}

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4