Serialize Json with data from an Array(collection class) in D365FO
Views (496)
Hi,
Earlier I provided code where we constructed Json by extracting values from a table (CustTable), but this may not be better choice if we have to serialize hundreds of data values. In such a case, below code would help us.
class CG_SerializeJsonFromArray{ /// <summary> /// Runs the class with the specified arguments. /// </summary> /// <param name = "_args">The specified arguments.</param> public static void main(Args _args) { str json; Array values = new Array(Types::String); values.value(1, "ItemA"); values.value(2, "ItemB"); values.value(3, "ItemC"); values.value(4, "ItemD"); json = FormJsonSerializer::serializeClass(values); info(strFmt("%1", json)); } }Output: https://drive.google.com/open?id=15yXI2vEHQajH60qA_Sg5nq3nfHaHa8Zj
Regards,
Chaitanya Golla

Like
Report
*This post is locked for comments