Hi,
In this post, we will see how to serialize the data to Json from a data view in D365FO. If we have all the required data from a single data view then this approach can be used. CustTableCube is chosen for demo.
class CG_SerializeJsonFromView
{
/// <summary>
/// Runs the class with the specified arguments.
/// </summary>
/// <param name = "_args">The specified arguments.</param>
public static void main(Args _args)
{
CustTableCube custTable;
JsonSerializerSettings settings = null;
str json;
select firstonly custTable
where custTable.AccountNum == "1000";
JsonViewSerializer jsonTable = new JsonViewSerializer(settings);
json = jsonTable.serialize(custTable);
info(strFmt("%1", json));
}
}
Output: https://drive.google.com/open?id=19L7VelzWJmG8nJPQjYv28qxK95lUNXv_
Regards,
Chaitanya Golla
*This post is locked for comments