def write_json(output, source, show_headers=True, show_tags=True,
    use_objects=False):
    """Serialize a dataset to JSON."""
    for line in source.gen_json(show_headers, show_tags, use_objects):
        output.write(line)
