input: Write a function to implement a basic blockchain system in Python. The function should include a hashing function using SHA256, a Block class to represent each block, and a Blockchain class to manage the chain of blocks. The Blockchain class should include methods to add blocks and to retrieve the entire blockchain in JSON format.
  
  assert sha256('example')=='c3499c2729730a7f807efb8676a92dcb6f8a3f8f3c1a0b214a2a3ccfe47b2000'
  assert sha256('another example')=='53a9f5e6aa02feba09ea5a7d63a6dc5e2fbc5027cc19805b1a92b2445ddaa8c7'
  
  block1 = Block(0, '2023-10-01T12:00:00', 'Genesis block', None)
  assert block1.hash == 'b6ed0a4a48791ba9fd18ccf9d4ea6de258761a1de8cd2607f080925d7fd32642'
  
  blockchain = Blockchain()
  blockchain.add_block({'timestamp': '2023-10-01T12:00:00', 'data': 'Genesis block'})
  blockchain.add_block({'timestamp': '2023-10-02T12:00:00', 'data': 'Transaction 1'})
  
  expected_json = '''
  [
    {
      "index": 0,
      "timestamp": "2023-10-01T12:00:00",
      "data": "Genesis block",
      "previous_hash": null,
      "hash": "b6ed0a4a48791ba9fd18ccf9d4ea6de258761a1de8cd2607f080925d7fd32642"
    },
    {
      "index": 1,
      "timestamp": "2023-10-02T12:00:00",
      "data": "Transaction 1",
      "previous_hash": "b6ed0a4a48791ba9fd18ccf9d4ea6de258761a1de8cd2607f080925d7fd32642",
      "hash": "4ff7dcb33a754dc7595bae382b5721808c281ab5fd983dc8a4af3f755317dd44"
    }
  ]
  '''
  assert blockchain.get_chain() == expected_json
output: import hashlib
  import json
  from datetime import datetime
  
  def sha256(data):
      return hashlib.sha256(data.encode()).hexdigest()
  
  class Block:
      def __init__(self, index, timestamp, data, previous_hash):
          self.index = index
          self.timestamp = timestamp
          self.data = data
          self.previous_hash = previous_hash
          self.hash = self.calculate_hash()
  
      def calculate_hash(self):
          block_string = json.dumps(self.__dict__, sort_keys=True).encode()
          return sha256(block_string.decode())
  
  class Blockchain:
      def __init__(self):
          self.chain = [self.create_genesis_block()]
  
      def create_genesis_block(self):
          return Block(0, '2023-10-01T12:00:00', 'Genesis block', None)
  
      def add_block(self, data):
          previous_block = self.chain[-1]
          new_index = previous_block.index + 1
          new_timestamp = datetime.now().isoformat()
          new_block = Block(new_index, new_timestamp, data, previous_block.hash)
          self.chain.append(new_block)
  
      def get_chain(self):
          return json.dumps([block.__dict__ for block in self.chain], indent=2)