Jsonix Enums Defined by an Array

by Alexey Valikov

HTML

<script src="https://rawgithub.com/highsource/jsonix/master/dist/Jsonix-all.js"></script>

JavaScript

var MyModule = {
    elementInfos: [{
        elementName: 'data',
        typeInfo: {
            localName: 'IntegerEnums',
            type: 'enumInfo',
            baseTypeInfo: 'Integer',
            values: {
                'one' : 1,
                'two' : '2',
                'three' : 3
            }
        }
    }]
};
var context = new Jsonix.Context([MyModule]);
var unmarshaller = context.createUnmarshaller();
var data = unmarshaller.unmarshalString('<data>two</data>');
console.log(data);