import json


def _format_json_object(obj):
    """Parses a serializable object into a consistently formatted JSON string.

    Returns:
        A str of formatted JSON serialized from the given object.

    Args:
        obj: an object or dict.
    """
    def default_serializer(value):
        if isinstance(value, bytes):
            return value.decode(errors='ignore')
        else:
            return None

    return str(json.dumps(obj, indent=2, sort_keys=True, ensure_ascii=False,
                          default=default_serializer, separators=(',', ': ')))