code: def encode(self, o):
          
          # This doesn't pass the iterator directly to ''.join() because it
          # sucks at reporting exceptions.  It's going to do this internally
          # anyway because it uses PySequence_Fast or similar.
          chunks = list(self.iterencode(o))
          return ''.join(chunks)
docs: Return a JSON string representation of a Python data structure.
  
          >>> JSONEncoder().encode({"foo": ["bar", "baz"]})
          '{"foo":["bar", "baz"]}'