input: Write a Python function to search for a book by title in a CSV file and return the results in JSON format.
  assert search_book('Harry Potter') == '[{"title": "Harry Potter and the Philosopher\'s Stone", "author": "J.K. Rowling", "year": 1997}, {"title": "Harry Potter and the Chamber of Secrets", "author": "J.K. Rowling", "year": 1998}]'
  assert search_book('The Hobbit') == '[{"title": "The Hobbit", "author": "J.R.R. Tolkien", "year": 1937}]'
  assert search_book('Unknown Book') == '[]'
output: import csv
  import json
  
  def search_book(title):
      results = []
      with open('books.csv', newline='', encoding='utf-8') as csvfile:
          reader = csv.DictReader(csvfile)
          for row in reader:
              if title.lower() in row['title'].lower():
                  results.append({
                      'title': row['title'],
                      'author': row['author'],
                      'year': int(row['year'])
                  })
      return json.dumps(results)