Here you can find the source of getString(ResultSet rs, String name)
public static String getString(ResultSet rs, String name)
//package com.java2s; //License from project: Open Source License import java.sql.ResultSet; import java.sql.SQLException; public class Main { public static String getString(ResultSet rs, String name) { try {/*from w ww . j av a 2 s .co m*/ return "\"" + name + "\":\"" + escapeQuotes(rs.getString(name)) + "\""; } catch (SQLException ex) { return "\"" + name + "\":\"error\""; } } public static String escapeQuotes(String str) { if (str == null || str.isEmpty()) return ""; str = str.replaceAll("\n", " "); str = str.replaceAll("\\\\", "\\\\\\\\"); return str.replaceAll("\"", "'"); } }