I now use the block 'length of list' and that solves the problem. I was misled by the fact that the variable was initialized as an empty dictionary, populated with the list of JSON KVP without any complaints and accessing that list as a dictionary works without errors.
Mhhhh... I smell a rat.
I've extracted a dictionary from the JSON string using the web component, but continued to use the raw JSON string further in the code and used it as if it were the extracted dictionary. Currently reviewing the code, replacing the references to the JSON string by references to the extracted dicts. Will take a while to sort this mess. Unfortunately AI2 didn't complain about using the raw JSON iso dictionaries, hence I never noticed this - until now.
Yep - it's right there under your nose. The most difficult code to debug is your own code, you see incorrect code as correct code. It is the same with a paragraph of text that has spelling and grammar errors, even words written backwards - the human brain just reads it all correctly