Detect the ideal type for the data, either using the explicit type
    definition or the format (for date, date-time, not supported by JSON).

def get_type(bind):
    """ Detect the ideal type for the data, either using the explicit type
    definition or the format (for date, date-time, not supported by JSON). """
    types = bind.types + [bind.schema.get('format')]
    for type_name in ('date-time', 'date', 'decimal', 'integer', 'boolean',
                      'number', 'string'):
        if type_name in types:
            return type_name
    return 'string'