Here you can find the source of jsonEscape(CharSequence s)
Parameter | Description |
---|---|
s | The string to esacape |
public static String jsonEscape(CharSequence s)
//package com.java2s; //License from project: LGPL public class Main { /**//from w w w .ja va 2s. c o m * Escapes json characters in the passed string * @param s The string to esacape * @return the escaped string */ public static String jsonEscape(CharSequence s) { return s.toString().replace("\"", "\\\"").replace("[", "\\[").replace("]", "\\]").replace("{", "\\{") .replace("}", "\\}"); } }