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
{{ message }}
Repository navigation
untyped objects deserialised by System.Text.Json are unsupprted #591
untyped objects with nested data deserialised by Newtonsoft can be used successfully with handlebars.net
consider:
var json = "{\"A\": {\"B\" : \"b\"}}";
object a = Newtonsoft.Json.JsonConvert.DeserializeObject(json)!;
string value = Handlebars.Create().Compile("{{A.B}}")(a);
value would be "b" (assuming I have no typos in the code.
However the same code won't work on an untyped object deserialised by System.Text.Json
object a = System.Text.Json.JsonSerializer.Deserialize<object>(json)!;
string value = Handlebars.Create().Compile("{{A.B}}")(a);
value will be "".
It would be great if the complex object deserialised by System.Text.Json could be used in handlebars templates, as per Newtonsoft.
Newtonsoft is not a part of the .NET standard library offering, and it would be good if Handlebars.NET worked well with the core libraries.
One key limitation that we have encountered is that untyped objects deserialised by Newtonsoft can't themselves be reliably serialised and deseriasied by the default .NET serialisation mechanism. This limits our ability to use Newtonsoft in our solution, and therefore we require native untyped object JSON support by handlebars.
Activity
feat: support System.Text.Json JsonElement in templates (issue #591)
Merge pull request #657 from Handlebars-Net/feat/issue-591-jsonelemen…