Very easy way to ascending sort a list

I accidentally found a very easy way to sort a list! :open_mouth:
I use TinyDB for sorting! Yes! Correct, TinyDB! :slight_smile:

Save a suffled list with TinyDB to local database as keys
and read back that keys, its ascending sorted anymore! :wink:

It works for letters;

and numbers too;

and if you want to prevent this weird fuction (as me!) just use “copy list” block between “value to store” and “sorted list” block;

I’m not sure is this a function or bug, but after solve this (with spending hours!), I can use this in my advantage anymore! :smiley:


Good find, use the reverse block for descending :slight_smile:


Very interesting! But AFAIK dictionary uses LinkedHashMap, which has order. Not sure why.


wish to know that before fight with tinydb! :smiley:

see Evan’s feedback from the MIT App Inventor team here

I don’t that this would technically be always guaranteed. JSON objects are considered unordered, so the key-value mappings can appear in any order and the objects are equivalent. Our implementation of dictionaries always keeps the key order as set by the user. My guess is that when we read the JSON serialization back from TinyDB that the parser orders the keys (even though it’s not needed), and that because the JSON functionality is Android dependent it might even change behavior from version to version of Android.
(copied freom a Power user thread)


@Gemi_Trafik, there’s no need to mark my post as solution as your topic will be closed after a month. :sweat_smile:
@Taifun thanks for clarifying!