from typing import OrderedDict
import json


def dump_json(obj, separators=(', ', ': '), sort_keys=False):
    """Dump object into a JSON string."""
    if sort_keys is None:
        sort_keys = not isinstance(obj, OrderedDict)  # Let it sort itself.
    return json.dumps(obj, separators=separators, sort_keys=sort_keys)