code: def convert(self, json="", table_attributes='border="1"', clubbing=True, encode=False, escape=True):
          
          # table attributes such as class, id, data-attr-*, etc.
          # eg: table_attributes = 'class = "table table-bordered sortable"'
          self.table_init_markup = "<table %s>" % table_attributes
          self.clubbing = clubbing
          self.escape = escape
          json_input = None
          if not json:
              json_input = {}
          elif type(json) in text_types:
              try:
                  json_input = json_parser.loads(json, object_pairs_hook=OrderedDict)
              except ValueError as e:
                  #so the string passed here is actually not a json string
                  # - let's analyze whether we want to pass on the error or use the string as-is as a text node
                  if u"Expecting property name" in text(e):
                      #if this specific json loads error is raised, then the user probably actually wanted to pass json, but made a mistake
                      raise e
                  json_input = json
          else:
              json_input = json
          converted = self.convert_json_node(json_input)
          if encode:
              return converted.encode('ascii', 'xmlcharrefreplace')
          return converted
docs: Convert JSON to HTML Table format