One can construct complex types by defining unions of special non-entity type definitions decorated with @variant. The resulting complex type is mapped into JSON at the database level and should be prefixed with _json in when queried through the API. Here is an example