Skip to content

Complex Data Type Return Types in Operations

Actions

OData Actions can have complex typed return types. But is should note that there is a limitation.

Primitive Arrays are not supported in Complex Return types

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.

Examples

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"  
            }  
        }  
    ]  
}  

Marble Code

Valid Structure

Not Supported

{  
    "RootAlpha": "Alpha1",  
    "RootBoolean": true,  
    "RootDate": "2018-10-01",  
    "RootNumArray": [ 1, 20, 24, 45 ],  
    "RootTextArray": [ "Text1", "Text2", "Text3" ]  
}  

Marble Code

Valid Structure

Functions

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.

Examples

Supported

{  
    "RootAlpha": "Alpha1",  
    "RootBoolean": true,  
    "RootDate": "2018-10-01",  
}  

Marble Code

Valid Structure

Not Supported

{  
    "RootAlpha": "Alpha1",  
    "RootBoolean": true,  
    "RootDate": "2018-10-01",  
    "Children": [  
        {  
            "Level1Integer": 1,  
            "Level1Enum": "Car",  
            "Child": {  
                "Level2Number": 1.95,  
                "Level2Text": "Text1"  
            }  
        }  
    ]  
}  

Marble Code

Valid Structure

Back