Decode a simple JSON using the Webviewer, webviewstring and some javascript

At the time of writing, the built in JsonTextDecode block:

returns a simple json in alphabetical order – by the key, as opposed to the same order in which it is presented. The method below uses a webviewer, the webviewstring, and some javascript to return a csv row string which can then be converted to a list in AppInventor

BLOCKS

(The file component is used to create the html file on the sdcard, which is then fed into the webviewer, along with the webviewstring which contains the json)

SCREEN (returns the original json and the parsed Ai2 list)

HTML (all in the text label)

<!DOCTYPE html>

<html>

<body>

<script>

var y = '';

var myObj = JSON.parse(window.AppInventor.getWebViewString());

for (x in myObj) {

y += x + ", " + myObj[x] + " : ";

window.AppInventor.setWebViewString(y);

}

</script>

</body>

</html>