String josnString = "{'name':'zhang'}";
if(josnString != null){
//取空格 换行 回车
Pattern p = Pattern.compile("\\s*|\t|\r|\n");
Matcher m = p.matcher(josnString.toString());
String after = m.replaceAll("");
try {
//取对象名
JSONObject a = new JSONObject(after);
System.out.println(a.get("name"));
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} }