OData Actions can have complex typed return types. But is should note that there is a limitation.
When returning a complex data type from an operation (function or action) arrays of primitive and enumeration types are not supported inside the complex return type in any level. But arrays of complex types are supported.
{ "RootAlpha": "Alpha1", "RootBoolean": true, "RootDate": "2018-10-01", "Children": [ { "Level1Integer": 1, "Level1Enum": "Car", "Child": { "Level2Number": 1.95, "Level2Text": "Text1" } }, { "Level1Integer": 3, "Level1Enum": "Suv", "Child": { "Level2Number": 3.69, "Level2Text": "Text2" } } ] }
{ "RootAlpha": "Alpha1", "RootBoolean": true, "RootDate": "2018-10-01", "RootNumArray": [ 1, 20, 24, 45 ], "RootTextArray": [ "Text1", "Text2", "Text3" ] }
OData Functions only supports single level complex structures. That is Functions cannot have Complex return type where it has attributes of Arrays or Complex data types.
{ "RootAlpha": "Alpha1", "RootBoolean": true, "RootDate": "2018-10-01", }
{ "RootAlpha": "Alpha1", "RootBoolean": true, "RootDate": "2018-10-01", "Children": [ { "Level1Integer": 1, "Level1Enum": "Car", "Child": { "Level2Number": 1.95, "Level2Text": "Text1" } } ] }