def _transform_array(data, is_array, is_scalar):
    """Transform an array into a scalar, single value array or return in unmodified."""
    if not is_array:
        return data[0]
    if is_scalar:
        return [data[0]]
    return data