Serialize Json with data from an Map in D365FO
Views (597)
Hi,
In this post, we will see the process of Serializing Json string with data from a Map in D365. I created a new map by name CG_Customers which gets the data from CustTable for the fields AccountNum and CustGroup.
Map: CG_Customers
Link: https://drive.google.com/open?id=1LlTOLIQlXk6aaYRuVNH_6Mi5auwecux4
Runnable Class: CG_SerializeJsonFromMap
class CG_SerializeJsonFromMap
{ /// <summary> /// Runs the class with the specified arguments. /// </summary> /// <param name = "_args">The specified arguments.</param> public static void main(Args _args) { CustTable custTable; JsonSerializerSettings settings = null; CG_Customers customer; str json; select firstonly AccountNum, CustGroup from custTable where custTable.AccountNum == "1000"; JsonMapSerializer jsonTable = new JsonMapSerializer(settings); customer = custTable; json = jsonTable.serialize(customer); info(strFmt("%1", json)); } }Output: https://drive.google.com/open?id=1dlBLR_now2lLnthcwDbGpXjBKnnruTBa
Regards,
Chaitanya Golla

Like
Report
*This post is locked for comments