-
Notifications
You must be signed in to change notification settings - Fork 213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#294 Would be nice if you could pass a JSON string into a template #304
Comments
The goal of this project is to provide a .NET implementation of Handlebars - there are great JSON parsers out there to solve that problem. |
Indeed, but it would be nice to be able to compile the template without having to deserialise the JSON and without having to know what values the template requires. If you have a large JSON payload but the template only uses a few values, it makes sense not to deserialise the JSON but to access just those properties. One could obviously use this to generate an anonymous object to then send to the template, but this would mean you need to know what properties the template needs ahead of time. If you could pass in a JSON string to the compiled template, it could use a JsonDocument to extract just the values it needs from the JSON string without having to deserialise it, and without the calling code having to know what values the template needs to access. If this isn't something you want to consider, is it possible to get a list of JSON properties the compiled template requires. That way, the list could be used to extract just those properties from a large JSON document without knowing ahead of time which values the template requires. Thanks. |
@Herostwist did you figure this out? All of my handlebars context are JSON files. I am trying to figure out how to covert them into format Handlebars.NET will consume. I just started using this today so I am new here but I have a ton of JSON to use. |
#294 Would be nice if you could pass a JSON string into a template as well as an object.
The text was updated successfully, but these errors were encountered: