Hello,
I have two json arrays in below code. The first json array I called _jsonStrone and I don't have any issue iterating the values. But in second _jsonStrtwo array I have issue to iterate the values of array and my real api doesn't contain any main key value to use in switch function to create a case. So I need iterate any element of array _jsonStrtwo and print the results even array doesn't contain key value like _jsonStrone as "branchList". Please advise.
static void readJSON(Args _args) { mapEnumerator mapEnumerator; Map data; List testList; str _jsonStrone, _jsonStrtwo; container test; ListEnumerator listEnumerator; int containerList; Map map1; int lengthIterate; str _conpkrsult; ; _jsonStrone = '{"branchList":["11102206","12104348","603","604","605","606","607"]}'; _jsonStrtwo = '[{"name":"Harry Potter","city":"London"},{"name":"Don Quixote","city":"Madrid"},{"name":"Joan of Arc","city":"Paris"},{"name":"Rosa Park","city":"Alabama"}]'; data = RetailCommonWebAPI::getMapFromJsonString(_jsonStrone); //_jsoStrtwo. mapEnumerator = data.getEnumerator(); while (mapEnumerator.moveNext()) { switch (mapEnumerator.currentKey()) { case "branchList" : test = mapEnumerator.currentValue(); testList =List::create(test); listEnumerator = testList.getEnumerator(); while (listEnumerator.moveNext()) { test = listEnumerator.current(); _conpkrsult = conpeek(test, 1); print _conpkrsult; pause; } break; } } }