def divide_transactions_in_batches(transactions, batches_number):
    """
    :param transactions: array of jsons
    example: [{'type': 'invoke', 'f': 'txn', 'value': [['r', 49, None], ['append', 47, 1], ['append', 49, 1], ['r', 48, None], ['r', 49, None], ['append', 45, 1]]}, {'type': 'invoke', 'f': 'txn', 'value': [['r', 46, None], ['append', 49, 2], ['r', 49, None], ['r', 48, None], ['r', 43, None]]}]
    :param batches_number: number of batches array to break in
    :return: array of transactions (array of arrays of jsons)
    """
    avg = len(transactions) / float(batches_number)
    batches = []
    last = 0.0

    while last < len(transactions):
        batches.append(transactions[int(last):int(last + avg)])
        last += avg

    return batches