jverzani/Mustache.jl

Data in `OrderedCollections.OrderedDict` is inaccessible

Kissaki opened this issue · 3 comments

The JSON package suggests using OrderedCollections.OrderedDict/DataStructures.OrderedDict if order of the keys is to be preserved.

So parsing a JSON file may be done by data = JSON.parsefile("data.json"; dicttype=OrderedCollections.OrderedDict), into an OrderedDict type. General use of the OrderedDict matches that of Dict.

However, it looks like Mustache.jl does not successfully access data from a OrderedDict. If I replace the JSON.parsefile call so it loads into a standard Dict the rendered mustache template yields the expected result.

Is this because Mustache.jl makes some hard type expectations? Is this because OrderedCollections is missing some standard operation functions for the introduced OrderedDict type?

(Although handling preserving key order is not a strict requirement for using mustache templates itself, there are other use cases where that makes sense, and it would be nice if mustache templates worked with this data without transformation.)

Let me look. This shouldn’t be a restriction.

Thank you

Thank you! I really appreciate the bug reports. They have greatly improved this package.