JSON data is written as key/value pair. The keys must be strings, written with double quotes
In your example the call to .Tostring finds a numeric key 7, so it is converted to its string representation "7"
The reverse conversion (.ToMap) considers the keys to be strings, and the JSON key "7" is convert to B4x string type "7"
in your code when doing ' For Each k As Int In m2.Keys ' there is a conversion of string to int, but the entry in the map for int 7 doesn't exist so the the list obtains by m2.get(k) is undefined(not initialized) :
- m2.get(7) => undefined
- m2.get("7") = > defined
you can also not force a type for the key during the for each loop and let the automatic conversion by b4x be done.
The code...