Problem with Nested Dictionaries and Lists

Hey, I am Logan. I need some help establishing if this is intended or a bug…

In JSON, lets say you have a list variable. What is it’s structure?

Screenshot 2021-07-26 143930


That’s fine, now replace those items with key-value pairs. Now it’s a “list of pairs”.

  (key_1, value_1),
  (key_2, value_2),
  (key_3, value_3)

Now, lets replace each of those values with dictionary.

  (key_1, {}),
  (key_2, {}),
  (key_3, {})

In each of those dictionaries, lets add some key and values.

  (key_1, {
    "key_1_1" : "value_1_1",
    "key_1_2" : "value_1_2"
  (key_2, {
    "key_2_1" : "value_2_1",
    "key_2_2" : "value_2_2"
  (key_3, {
    "key_3_1" : "value_3_1",
    "key_3_2" : "value_3_2"

Now, let us replace those values with lists.

  (key_1, {
    "key_1_1" : [ ],
    "key_1_2" : [ ]  
  (key_2, {
    "key_2_1" : [ ],
    "key_2_2" : [ ]
  (key_3, {
    "key_3_1" : [ ],
    "key_3_2" : [ ]

Now… Let’s stop here, because this is where I am having issues.
Everything up to this point formats correctly in Kodular. However, the last nested lists, if they were empty when the screen initializes and I was to add key-value pairs making it a paired-list, then I can use all the regular methods for “lists” in Kodular. I can lookup pairs, I can find by index or find the index of a pair, etc…

However… IF the lists had pairs inside them when the screen initalizes, the world ends. I can no longer use lookup pairs, or find the index or use an index because Kodular converts this list and all future lists to dictionaries

I am posting due to the problems that it is causing with my app data structuring (nested lists, nested dictionaries and combinations). It is catastrophic and will require complete restructuring if this is an intended feature.

Like I said in my explaination, if the list is empty then it stays a “List” and nothing is effected if I add more nested pairs, lists, dictionaries, etc… But if it has anything in it (like when I recall a saved data), it breaks everything.

Can someone explain why this is happening? Or tell me if this is something that App Inventor or Kodular intended for.

Thank you for your time, and hopefully I explained things clearly/organized enough that my issue can be understood (and not sound like gibberish). If I need to clarify anything, then let me know.

– Logan (a.k.a. DarkComet)

1 Like

Did you report this to the App Inventor developers? Normally i would say not to double post but in this case i would be interested to get a response from the AI developers too. Do you get the same behavior there?

Can you explain in what situation you would use something like this?

The " Key xxxx Value xxxx" block can only be used in "make a dictionary ", not in a “make a list” block

1 Like

This should be fixed in the next version of App Inventor.


I only use Kodular for my project, so I wouldn’t know. However, that is a good idea. Let me test it on App Inventor, and I’ll update with the results. And no, I have only posted on Kodular’s community forums.

Really? It works in most cases, except if the nesting is too deep (my main problem). I’ve used it enough to know it works. I thought that is how you make a list of paired values, is it not?

(key1, value),
(key2, value),
(key3, value)

It formats correctly with Kodular when you show the results by label or notification for simplier stuff. It is a List and not a Dictionary, so you cannot use most Dictionary methods with it, only the List ones.


Yes, for my application I created a “database” written in JSON schema that uses dictionaries and lists to access it. It is object-oriented and NoSQL, but semi-structured (some hierarchy). The closest example to its structure would likely be MongoDB.

My entire app is built on this structure and I’ve made custom functions/procedures to access, store, lookup, sort/organize, etc…

The reason I use paired-value lists instead of dictionaries for some cases is because I’ve built the database (for some of the data) to be made up of self-sorting lists. Also, lists can be searched by index or stored by index while dictionaries cannot, but key-value pairs (that dictionaries use) are useful because they use unique IDs instead of just using the index like lists.

Below is the basic framework of my database (there are more branches, but this is the top level and how unique IDs are managed/stored).

Each sub-database contains a list of objects (that contain attributes) with reference/hierarchy to more specific objects contained in the other sub-database. The master database is what contains all the IDs and what the sub-databases reference to get details about one another. Each sub-database is a tier below the previous (1 is higher than 2, etc…) which narrows the scope and accessible data. When I want to change the property/attribute of an object I just need the id-address (hierarchy order of sub-domains).

It is written in native JSON and I have procedures/methods that maintain, sort, filter, etc… It can store any type of file (even nested JSON files if needed) or you can store the files storage address.

The database is built upon first time opening the app and then retrieved as a compressed file upon each subsequent launch of the app.

I’ve been working on my app for the past year and the entire database was built from scratch.

1 Like

@DarkComet Please quote people in one post… There’s no need to create multiple replies.

Oh, nice! I knew it must have been related with some condition being met because it works for empty lists (then storing new data), but doesn’t work for full lists (then storing new data) as it converts everything to dictionaries as if I am using no lists at all.

Thank you. I wasn’t sure if it was App Inventor source code or Kodular.

I looked at the problem on github. It says that it is already merged and code was changed back in February/March of this year. Does merged mean the problem was closed/solved?

My bad, I can do that. I read in another post that people didn’t like and got angry about being tagged in posts. Wait, are you talking about quoting a post or tagging a username?

Tagging people in the first post of your topic is what isn’t allowed. However, quoting someone in a reply (one reply) is fine, as it will consolidate the quotes into one mention.

1 Like


From my testing on App Inventor 2, this appears to still be an issue for both builders (AI2 & Kodular).

This AIA project is a little janky and quickly thrown together, but it shows the issues in App Inventor. On run time the list of key-value pairs are converted to a dictionary, however if the list is empty on runtime, everything is fine (format is correct).

App Inventor 2 AIA:
AI2_Nested_List_Bug_Test.aia (6.4 KB)

Also Peter, I posted the problem on the Github issues page that you linked to. Should I also make a post on App Inventor’s community forum?