Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 

19 righe
473 B

  1. from __future__ import annotations
  2. import json as _json
  3. import typing as t
  4. class _CompactJSON:
  5. """Wrapper around json module that strips whitespace."""
  6. @staticmethod
  7. def loads(payload: str | bytes) -> t.Any:
  8. return _json.loads(payload)
  9. @staticmethod
  10. def dumps(obj: t.Any, **kwargs: t.Any) -> str:
  11. kwargs.setdefault("ensure_ascii", False)
  12. kwargs.setdefault("separators", (",", ":"))
  13. return _json.dumps(obj, **kwargs)