Deserialize Json build from an array of values in D365FO
Views (684)
Hi,
In this post we will see the process of deserializing Json build from an array of values. For demo purpose, I build an array with string values, serialized json string with them and deserialized json string.
Runnable class: CG_DeSerializeJsonFromArray
class CG_DeSerializeJsonFromArray{ /// <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"); // Serializing Json json = FormJsonSerializer::serializeClass(values); // Deserializing Json values = FormJsonSerializer::deserializeCollection(classnum(Array), json, Types::String); for(int i=1; i <= 4;i++) { info(strFmt("Value: %1", values.value(i))); } } }Output: https://drive.google.com/open?id=1bqudPfyYPmRK3bMRO92Kk025m1JWwyEM
Regards,
Chaitanya Golla

Like
Report
*This post is locked for comments