<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, root_id = 0, output = {}):
 """ Recursive function to dump this tree as a json blob. Parameters root_id: Root id of the sub-tree output: Carry over output from the previous sub-trees. Returns ------- dict: A tree in JSON format. Starts at the root node and recursively represents each node in JSON. - node_id : ID of the node. - left_id : ID of left child (None if it doesn't exist). - right_id : ID of right child (None if it doesn't exist). - split_feature_column : Feature column on which a decision is made. - split_feature_index : Feature index (within that column) on which the decision is made. - is_leaf : Is this node a leaf node? - node_type : Node type (categorical, numerical, leaf etc.) - value : Prediction (if leaf), decision split point (if not leaf). - left : JSON representation of the left node. - right : JSON representation of the right node. Examples -------- .. sourcecode:: python {'is_leaf': False, 'left': {'is_leaf': True, 'left_id': None, 'node_id': 115, 'node_type': u'leaf', 'parent_id': 60, 'right_id': None, 'split_feature_column': None, 'split_feature_index': None, 'value': 0.436364}, 'left_id': 115, 'node_id': 60, 'node_type': u'float', 'parent_id': 29, 'right': {'is_leaf': True, 'left_id': None, 'node_id': 116, 'node_type': u'leaf', 'parent_id': 60, 'right_id': None, 'split_feature_column': None, 'split_feature_index': None, 'value': -0.105882}, 'right_id': 116, 'split_feature_column': 'Quantity_features_14', 'split_feature_index': 'count_sum', 'value': 22.5} """

        _raise_error_if_not_of_type(root_id, [int,long], "root_id")
        _numeric_param_check_range("root_id", root_id, 0, self.num_nodes - 1)

        node = self.nodes[root_id]
        output = node.to_dict()
        if node.left_id is not None:
            j = node.left_id
            output['left'] = self.to_json(j, output)
        if node.right_id is not None:
            j = node.right_id
            output['right'] = self.to_json(j, output)
        return output