Skip to content

Instantly share code, notes, and snippets.

View svyatoslav-ps's full-sized avatar

Svyatoslav Potyeyenko svyatoslav-ps

View GitHub Profile
@jannismain
jannismain / CompactJSONEncoder.py
Last active October 25, 2024 15:50
A JSON Encoder in Python, that puts small lists on single lines.
#!/usr/bin/env python3
from __future__ import annotations
import json
class CompactJSONEncoder(json.JSONEncoder):
"""A JSON Encoder that puts small containers on single lines."""
CONTAINER_TYPES = (list, tuple, dict)