Consuming REST services that uses Mendix reserved words

We want to consume a REST service that returns elements with the names 'id' and 'type'. These names are reserved words in Mendix so we cannot create attributes with these names in the non-persistable entity that matches the JSON result set. Is there a workaround for this situation?
2 answers

Hi Talpax,

Yes, you can prefix the name with '_' in your Mendix domain model. It will still be picked up by the module.

See the remark halfway the deserialization section in the docs:

A member name matches if the names are the same in a case sensitive way. The module will also look for attributes that have an additional underscore (_) as prefix. This is to be able to prevent name collisions with references and to be able to use attributes with a name that are reserved within Mendix. For associations, the module name is never considered


This is not a solution for sending REST to (for example) Mandril. There is a 'type' attribute: the header type to use for the recipient, defaults to "to" if not provided oneof(to, cc, bcc). It can not be passed as ' type' because Mandrill does not recognize the keyword 'type'.