How to pass complex object to extension?

I am in process of developing pdf generator as requirement in .net extension and needs to pass couple of objects into extension to print/display the  fields and their values. I tried to create structure in extension and pass as object type but still I am getting error {"Errors":["Specified cast is not valid."],"StatusCode":500}.

Below is the code I have developed in extension.

public void MsscreatePDF(object ssRequest, object ssRequestAddress, object ssRequestDetail, out byte[] sspdf) {

            //OutSystems.HubEdition.RuntimePlatform.Log.GeneralLog log = new OutSystems.HubEdition.RuntimePlatform.Log.GeneralLog();

            STRequestStructure obj = new STRequestStructure();

             obj= (STRequestStructure)ssRequest ;




 I do appreciate your guidline in how to pass complex object and get those values in the above function

You need to create the structure in the extension, and declare your action input parameter to be of Data Type = Record, and then you'll be able to choose which structure in the Record Definition. Remember, all of this should be done in the extension, in Integration Studio.