Am 31.08.15 um 02:18 schrieb Eric Martz:
> Using Jmol August 25:
>
> Conversion to JSON seems to scramble the order of keys in the
> associative array. In the examples below, notice how the keys ABC become
> ACB when formatted as JSON; and ABCD -> ADCB. Is this a bug?
>
In hashes (associative arrays) you usually don't have a guaranteed order
of hash keys. If order is important you have to take care yourself of
the key order.
If you stay within a system it usually should be sufficient to loop
through the keys with a sort function, e.g.:
for (hashKey IN exampleHash.keys.sort) {
print hashKey;
}
If you transfer data between systems for example with JSON the safest
way is tor transfer a sorted standard array with the hash keys together
with the hash.
Regards,
Rolf
------------------------------------------------------------------------------
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users