Sample Json. { "status": { "code": 200, "message": "Success!" }, "payLoad": { "bizTalkFileName": "abc.txt", "shortDescription": "Message(s) succssfully received" } } mapEnumerator mapEnumerator; Map data; data = RetailCommonWebAPI::getMapFromJsonString(s); mapEnumerator = data.getEnumerator(); while (mapEnumerator.moveNext()) { switch (mapEnumerator.currentKey()) { case "status": Map statusMap; container val = mapEnumerator.currentValue(); statusMap = Map::create(val); MapIterator mi = new MapIterator(statusMap); while (mi.more()) { container valuePair = mi.valuePair(); if (conPeek(valuePair,1) == "code") { container value = conPeek(valuePair,2); if (conPeek(value,1) == "200") { info("File sent to Biztalk successfully."); } } mi.next(); } break; case "payload": Map loadMap; container loadVal = mapEnumerator.currentValue(); loadMap = Map::create(loadVal); MapIterator loadMI = new MapIterator(loadMap); while (loadMI.more()) { container valuePair = mi.valuePair(); if (conPeek(valuePair,1) == "bizTalkFileName") { container fileVal = conPeek(valuePair,2); str filename = conPeek(fileVal,1); filename += filename; } mi.next(); } break; } } }
adsenseheader
Thursday, December 1, 2022
Deserialise json in D365 fo
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment