Can anyone provide a pointer as to where I am going wrong, or what I can do to fix this? This needs to be done in the code, not in the app, so that the user/developer is presented with clean keys.
(note: appId and projectId are just placeholders)
I have also tried with replaceAll(), but only as above.
I don't see why the extra replacement of "\"" to "\\\"" is necessary. If the string already contains valid JSON then this will actually make it become invalid JSON. As you've demonstrated in your screenshots, the replace method does the right thing without having to do any substitution on the double quote character.
In Java string literals you have to escape the double quotes otherwise they would be interpreted as the end of the string. They're not actually escaped in the content of the string, it's solely for the purpose of communicating with the tokenizer.
As this is fairly trivial to do with blocks, can you please point me to the sources java for dictionaries and lists, and I will see if I can figure it out from there.
So you want to convert a JSON string to dictionaries?
I have an open source extension that might help you. It was originally for only Kodular, because the Web component in Kodular does not have JsonTextDecodeWithDictionaries, but you can look at the source code.
If JSON is same format as you mentioned on the first post then it is way much easier to get array using org.json's classes. You don't need to add any dependency on your extension for this as AppInventor already uses org.json classes(or maybe Android Sdk already have org.json)
[EDIT : You already posted about this before me while i was writing code here ]
It is a better solution in many ways , so thank you for your work , but Evan's approach returns the data in a format that matches other returns I get from what I am up to