mikebridge / Liquid.NET

.Net Port of the Liquid template language
MIT License
62 stars 15 forks source link

Json dump of a liquid hash is invalid. #67

Open syte opened 6 years ago

syte commented 6 years ago

Currently whenever I dump a liquid hash, it serializes empty enumerables into nothing. Also, enumerables aren't wrapped in brackets, and each item in the list isn't being separated from the next with a comma.

Example: { facets: , results: { name: 'Test' } { name: 'Test2' } }

Expected value: { facets: [], results: [{ name: 'Test' }, { name: 'Test2' }] }

mikebridge commented 6 years ago

Is that from just putting a hash directly into a template? I don't think I really covered that case---I have a default stringification method for that but it is not very robust.

I can probably add a hook for a JSON serializer into the initialization so that it doesn't take a dependency on NewtonSoft.

syte commented 6 years ago

@mikebridge , yes it's from putting the hash directly into the template. I do like your idea of being able to add a hook for serialization.