<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def to_json(self, variables=None):
 """Render the blueprint and return the template in json form. Args: variables (dict):
 Optional dictionary providing/overriding variable values. Returns: str: the rendered CFN JSON template """


        variables_to_resolve = []
        if variables:
            for key, value in variables.items():
                variables_to_resolve.append(Variable(key, value))
        for k in self.get_parameter_definitions():
            if not variables or k not in variables:
                # The provided value for a CFN parameter has no effect in this
                # context (generating the CFN template), so any string can be
                # provided for its value - just needs to be something
                variables_to_resolve.append(Variable(k, 'unused_value'))
        self.resolve_variables(variables_to_resolve)

        return self.render_template()[1]