Subject: | optionally preserve hash order when loading |
The current implementation of YAML does not allow to preserve the hash
order when loading a YAML document. I know, this is not really in the
spec, but:
- YAML documents come with an implicit order of the keys (as they appear
in the document)
- YAML::Node supports to keep the hash order via a tied hash
In fact, with the Loader changed on one line (around ~326):
-my $mapping = {};
+require YAML::Node;
+my $mapping = YAML::Node->new({});
... this works immediately! I am wondering whether this could not be
provided as a global option e.g. when $YAML::SortKeys is set to 0.
What do you think?
Many thanks,
Marek