-
Notifications
You must be signed in to change notification settings - Fork 78
Mapping Styles
Jsonix supports different mapping styles.
Jsonix mapping defines structure of simple and complex types and root elements of the schema. But there may be different interpretations of how exactly should these types and their properties be represented in a JavaScript object structure.
In fact, there are different conventions on how it could be done. The following document lists a number of such conventions:
For instance, if we have an attribute property named att
for an attribute names ATT
, both of these JavaScript object structures would be an adequate representation:
{ 'att' : 'value' }
{ `@ATT` : 'value' }
Jsonix mapping styles intend to capture, how exactly types and properties from Jsonix mappings should be represented in the JavaScript object structure. For instance a standard mapping style (used by default) uses names of the properties from Jsonix mappings as property names in object structures. In the example above, the standard mapping would use att
as the property name. But this may be different in another mapping style.
Currently Jsonix supports two mapping styles:
You can select the mapping style using the mappingStyle
option passed to the context:
// Create a Jsonix context
var context = new Jsonix.Context(mappings, {
mappingStyle : 'simplified'
});