code: def tojson(table, source=None, prefix=None, suffix=None, *args, **kwargs):
      
  
      obj = list(_dicts(table))
      _writejson(source, obj, prefix, suffix, *args, **kwargs)
docs: Write a table in JSON format, with rows output as JSON objects. E.g.::
  
          >>> import petl as etl
          >>> table1 = [['foo', 'bar'],
          ...           ['a', 1],
          ...           ['b', 2],
          ...           ['c', 2]]
          >>> etl.tojson(table1, 'example.json', sort_keys=True)
          >>> # check what it did
          ... print(open('example.json').read())
          [{"bar": 1, "foo": "a"}, {"bar": 2, "foo": "b"}, {"bar": 2, "foo": "c"}]
  
      Note that this is currently not streaming, all data is loaded into memory
      before being written to the file.