def _ToJSonObj(self, columns_order=None, order_by=()):
if columns_order is None:<EOL><INDENT>columns_order = [col["<STR_LIT:id>"] for col in self.__columns]<EOL><DEDENT>col_dict = dict([(col["<STR_LIT:id>"], col) for col in self.__columns])<EOL>col_objs = []<EOL>for col_id in columns_order:<EOL><INDENT>col_obj = {"<STR_LIT:id>": col_dict[col_id]["<STR_LIT:id>"],<EOL>"<STR_LIT:label>": col_dict[col_id]["<STR_LIT:label>"],<EOL>"<STR_LIT:type>": col_dict[col_id]["<STR_LIT:type>"]}<EOL>if col_dict[col_id]["<STR_LIT>"]:<EOL><INDENT>col_obj["<STR_LIT:p>"] = col_dict[col_id]["<STR_LIT>"]<EOL><DEDENT>col_objs.append(col_obj)<EOL><DEDENT>row_objs = []<EOL>for row, cp in self._PreparedData(order_by):<EOL><INDENT>cell_objs = []<EOL>for col in columns_order:<EOL><INDENT>value = self.CoerceValue(row.get(col, None), col_dict[col]["<STR_LIT:type>"])<EOL>if value is None:<EOL><INDENT>cell_obj = None<EOL><DEDENT>elif isinstance(value, tuple):<EOL><INDENT>cell_obj = {"<STR_LIT:v>": value[<NUM_LIT:0>]}<EOL>if len(value) > <NUM_LIT:1> and value[<NUM_LIT:1>] is not None:<EOL><INDENT>cell_obj["<STR_LIT:f>"] = value[<NUM_LIT:1>]<EOL><DEDENT>if len(value) == <NUM_LIT:3>:<EOL><INDENT>cell_obj["<STR_LIT:p>"] = value[<NUM_LIT:2>]<EOL><DEDENT><DEDENT>else:<EOL><INDENT>cell_obj = {"<STR_LIT:v>": value}<EOL><DEDENT>cell_objs.append(cell_obj)<EOL><DEDENT>row_obj = {"<STR_LIT:c>": cell_objs}<EOL>if cp:<EOL><INDENT>row_obj["<STR_LIT:p>"] = cp<EOL><DEDENT>row_objs.append(row_obj)<EOL><DEDENT>json_obj = {"<STR_LIT>": col_objs, "<STR_LIT>": row_objs}<EOL>if self.custom_properties:<EOL><INDENT>json_obj["<STR_LIT:p>"] = self.custom_properties<EOL><DEDENT>return json_obj<EOL>
Returns an object suitable to be converted to JSON.

        Args:
          columns_order: Optional. A list of all column IDs in the order in which
                         you want them created in the output table. If specified,
                         all column IDs must be present.
          order_by: Optional. Specifies the name of the column(s) to sort by.
                    Passed as is to _PreparedData().

        Returns:
          A dictionary object for use by ToJSon or ToJSonResponse.