public String toTruncateJson(Long length) {
        String jsonStr = JSONUtil.toJsonStr(this);
        long overLength = jsonStr.length() - length;
        if (overLength <= 0) {
            return jsonStr;
        }
        this.truncationFlag = true;
        if (CollectionUtil.isEmpty(rowData)) {
            this.columns = Sets.newLinkedHashSet();
            String finalJsonStr = JSONUtil.toJsonStr(this);
            if (finalJsonStr.length() > length) {
                log.warn(
                        "The row data and columns is empty, but still exceeds the length limit. "
                                + "Json: {}, length: {}",
                        finalJsonStr,
                        length);
                return "{}";
            }
            return finalJsonStr;
        }
        // Estimate the size of each row of data to determine how many rows should be removed.
        String lineJsonStr = JSONUtil.toJsonStr(rowData.get(rowData.size() - 1));
        int lineLength = lineJsonStr.length();
        int removeLine = getRemoveLine(overLength, lineLength, rowData.size());
        rowData = ListUtil.sub(rowData, 0, rowData.size() - removeLine);
        return toTruncateJson(length);
    }
@Test
    public void toTruncateJsonTest3() {
        SelectResult selectResult = prepareData();
        String truncateJson = selectResult.toTruncateJson(250L);
        log.info("truncateJson: {}", truncateJson);
        selectResult.setRowData(Lists.newArrayList(selectResult.getRowData().get(0)));
        assertEquals(JSONUtil.toJsonStr(selectResult), truncateJson);
    }