import json


def make_json(structure, variable_name=None, indent=1, **k):
    """Converts something into a json string, optionally attributing the result
    to a variable.

    It also escapes the forward slash, making the result suitable
    to be included in an HTML <script> tag.
    """
    s = json.dumps(structure, indent=indent, **k).replace('/', '\/')
    return "{0} = {1};\n".format(variable_name, s) if variable_name \
        else s