Search code examples
c#jsontemplatesliquid.net

How do I use a JSON string as variable data for a Liquid.NET template?


I'm looking for the best way to use a JSON string as the variable data for a Liquid.NET template. I don't know the structure of the JSON so I am unable to deserialize it to a POCO before using it.

I attempted to use the .ToLiquid() extension method on a JSON.Net JObject but it throws a memory exception.

I may need to convert the JSON to a LiquidHash before merging it with the template. Is there a utility that provides this or do I need to iterate over all the nodes myself?

https://github.com/mikebridge/Liquid.NET


Solution

  • You currently need to generate a LiquidHash manually.