import json
from typing import OrderedDict


def json_pp_dumps(obj, **kw):
  """Pretty json.dumps replacement."""
  return json.dumps(json.loads(json.dumps(obj),
                               parse_float=lambda f: round(float(f), 7),
                               object_pairs_hook=OrderedDict),
                   **kw)