import json


def json_dumps(obj):
    """A wrapper to `json.dumps` that provides the common arguments used
    throughout the code

    Args:
        obj (object): Object to convert to JSON

    Returns:
        str: String containing formatted JSON
    """
    def sort(o):
        if isinstance(o, list):
            if len(o) > 0 and isinstance(o[0], str):
                o.sort()
            else:
                for i in o:
                    sort(i)
        elif isinstance(o, dict):
            for k,v in o.items():
                sort(v)
        return o

    return json.dumps(sort(obj), indent=2, sort_keys=True)