title: TypeError: Object of type WorkItem is not JSON serializable
body: <p>I received this error after running the script below. I would like to create a json file through the result that is generated in this script. What can I do to correct this problem?</p>
  
  <p>I tried to do it via API but I couldn't get the fields I need from this DevOps table.</p>
  
  <pre><code>from azure.devops.connection import Connection
  from msrest.authentication import BasicAuthentication
  from azure.devops.v5_1.work_item_tracking.models import Wiql
  import json
  
  token = 'xxx'
  team_instance = 'https://dev.azure.com/xxx'
  
  credentials = BasicAuthentication("", token)
  connection = Connection(base_url=team_instance, creds=credentials)
  
  def print_work_items(work_items):
      for work_item in work_items:
          with open('teste_project.json', 'w') as json_file:
              json.dump(work_items, json_file)
  
  wit_client = connection.clients.get_work_item_tracking_client()
  
  def get_TC_from_query(query):
      query_wiql = Wiql(query=query)
      results = wit_client.query_by_wiql(query_wiql).work_items
      # WIQL query gives a WorkItemReference =&gt; we get the corresponding WorkItem from id
      work_items = (wit_client.get_work_item(int(result.id)) for result in results)
      print_work_items(work_items)
  
  get_TC_from_query(
      """\
  SELECT *
  FROM workitems
  WHERE
          [System.TeamProject] = 'xxx'
          and [System.WorkItemType] = 'Product Backlog Item'
          and [System.State] = 'Done'
  ORDER BY [System.ChangedDate] DESC
  """
  )    
  </code></pre>
  
  <blockquote>
    <p>TypeError: Object of type WorkItem is not JSON serializable</p>
  </blockquote>