Hi Christian,
Thanks. I know the order is not significant in maps/json by definition, but I was wondering why to change the original order anyway. I was also trying to hack it adding initial numbers in the key names, but it does not work (but it does if key names are only numbers). What is the BaseX rationale for order?
Bottom line: I am trying to "closely" reproduce some Python code involving dictionaries, where original order in dictionary.keys() is now interestingly kept (from Python 3.6, as far as I know). Unfortunately, the computation on the dictionary values assumes a specific order of the keys (which is not even an alphabetical one )...
Universität Leipzig Institute of Computer Science, NLP Augustusplatz 10 04109 Leipzig Deutschland E-mail: celano@informatik.uni-leipzig.de E-mail: giuseppegacelano@gmail.com Web site 1: http://www.dh.uni-leipzig.de/wo/team/ Web site 2: https://sites.google.com/site/giuseppegacelano/
On Jul 13, 2018, at 12:57 AM, Giuseppe Celano celano@informatik.uni-leipzig.de wrote:
Hi
Is it possible to preserve the order of the keys in a map when the map is returned?:
map{"b": 2, "c": 2, "a": 3}
return
map { "a": 3, "b": 2, "c": 2 }
Thanks! Giuseppe