Skip to main content

Notifications

Community site session details

Community site session details

Session Id :

Serialize Json with data from a table in D365FO

Chaitanya Golla Profile Picture Chaitanya Golla 17,225

Hi,

In this post, we will see how to serialize the data to Json from a table in D365FO. If we have all the required data in a single table then this approach can be used.

class CG_SerializeJsonFromTable
{       
    /// <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;
        str json;
 
        select firstonly custTable
            where custTable.AccountNum == "1000";
 
        JsonTableSerializer jsonTable = new JsonTableSerializer(settings);
 
        json = jsonTable.serialize(custTable);
 
        Info(strFmt("%1", json));
    }
 
}

Output: https://drive.google.com/open?id=1pptktN6Js7BEpoPOePzLKF7bq9v5XuAN

Regards,

Chaitanya Golla

Comments

*This post is locked for comments