import json


def escape(content: str) -> str:
    """Escape string using `json`.

    Note:
        Use `json.dumps` instead of `repr` to keep compatible with JavaScript
        extractor, which has only `JSON` library.

    Args:
        content (str): string to escape.

    Returns:
        str: escaped result.
    """
    return json.dumps(content)[1:-1]