Fault json format : {"message":"","classname":"","stacktrace":["","",""]}

@param json
@return
760658
public static Fault createFromJson(String json) {
		Fault fault = new Fault(null, 0);
		try (JsonReader reader = Json.createReader(new StringReader(json))) {
			JsonObject root = reader.readObject();
			fault.message = root.getString(Constants.Message.Fault.MESSAGE);
			fault.classname = root.getString(Constants.Message.Fault.CLASSNAME);
		}
		return fault;
	}
606350
public static JSONObject fromJSON(String json) {
    int index1 = json.lastIndexOf("\"_i\":\"");
    if (index1 < 0)
      throw new JsonParseException("Unable to find _i key.");
    index1 += 6;
    int index2 = json.indexOf("\"", index1 + 1);
    if (index2 < 0)
      throw new JsonParseException("Unable to find end of _i value.");
    String id = json.substring(index1, index2);
    Class<? extends JSONObject> clazz = registrations.get(id);
    if (clazz == null){
      // See if the id is a full classname
      try{
        clazz = (Class<? extends JSONObject>) Class.forName(id);
        registrations.put(id, clazz);
      }catch(ClassNotFoundException ex){
        throw new JsonParseException("No registration for JSONObject message.identifier:" + id);
      }
    }
    return fromJSON(json, clazz);
  }
1183190
public static Parameters fromJson(String json) {
		Map<String, Object> map = JsonConverter.toNullableMap(json);
		return map != null ? new Parameters(map) : new Parameters();
	}
468024
public static Map<String, Object> evalJSON(String json) throws JSONFormatException {
        JSONParser parser = new JSONParser();
        JSONObject o = null;
        try {
            o = (JSONObject)parser.parse(json);
        } catch (ParseException e) {
            throw new JSONFormatException(e.getMessage(),e);
        }
        return o;
    }
1195191
public static TaskRouting fromJson(String json) throws IOException {
        ObjectMapper mapper = new ObjectMapper();
        return mapper.readValue(json, TaskRouting.class);
    }
1089801
public static KeyPair buildECKeyPairFromJwk(final String json) {
        CommonHelper.assertNotBlank("json", json);

        try {
            final ECKey ecKey = ECKey.parse(json);
            return ecKey.toKeyPair();
        } catch (final JOSEException | ParseException e) {
            throw new TechnicalException(e);
        }
    }
563143
private Map<String, Object> getMapFromJSON(String json) {
        Map<String, Object> propMap = new HashMap<String, Object>();
        ObjectMapper mapper = new ObjectMapper();

        // Initialize string if empty
        if (json == null || json.length() == 0) {
            json = "{}";
        }

        try {
            // Convert string
            propMap = mapper.readValue(json, new TypeReference<HashMap<String, Object>>(){});
        } catch (Exception e) {
            ;
        }
        return propMap;
    }
1030935
public void showJson(String json) {
		try {
			JsonFactory jsonFactory = new JsonFactory();
			ObjectMapper objectMapper = new ObjectMapper();
			StringWriter stringWriter = new StringWriter();

			JsonParser jsonParser = jsonFactory.createJsonParser(new StringReader(json));
			JsonNode jsonNode = objectMapper.readTree(jsonParser);
			JsonGenerator jsonGenerator = jsonFactory.createJsonGenerator(stringWriter);
			jsonGenerator.useDefaultPrettyPrinter();

			objectMapper.writeTree(jsonGenerator, jsonNode);

			jsonGenerator.flush();
			jsonGenerator.close();
		} catch (Throwable throwable) {
			// hmm, somewhat accidentally crashed?
		}
	}
528329
private String asJSON(Object entity) {

        String entityJson = null;

        try {
            entityJson = this.mapper.writeValueAsString(entity);
        } catch (Exception e) {
            LOG.error("Could not parse as JSON: " + e.getMessage());
        }

        return entityJson;
    }
1301982
public static JWSObject deserialize(String json) throws IOException {
        ObjectMapper mapper = new ObjectMapper();
        return mapper.readValue(json, JWSObject.class);
    }
1337772
public static String format(String json) {
		final StringBuffer result = new StringBuffer();

		Character wrapChar = null;
		boolean isEscapeMode = false;
		int length = json.length();
		int number = 0;
		char key = 0;
		for (int i = 0; i < length; i++) {
			key = json.charAt(i);
			
			if('"' == key || '\'' == key) {
				if(null == wrapChar) {
					//字符串模式开始
					wrapChar = key;
				}else if(isEscapeMode) {
					//在字符串模式下的转义
					isEscapeMode = false;
				}else if(wrapChar.equals(key)){
					//字符串包装结束
					wrapChar = null;
				}
				result.append(key);
				continue;
			}else if('\\' == key) {
				if(null != wrapChar) {
					//字符串模式下转义有效
					isEscapeMode = !isEscapeMode;
					result.append(key);
					continue;
				}else {
					result.append(key);
				}
			}
			
			if(null != wrapChar) {
				//字符串模式
				result.append(key);
				continue;
			}
			
			//如果当前字符是前方括号、前花括号做如下处理：
			if ((key == '[') || (key == '{')) {
				//如果前面还有字符，并且字符为“：”，打印：换行和缩进字符字符串。
				if ((i - 1 > 0) && (json.charAt(i - 1) == ':')) {
					result.append(NEW_LINE);
					result.append(indent(number));
				}
				result.append(key);
				//前方括号、前花括号，的后面必须换行。打印：换行。
				result.append(NEW_LINE);
				//每出现一次前方括号、前花括号；缩进次数增加一次。打印：新行缩进。
				number++;
				result.append(indent(number));

				continue;
			}

			// 3、如果当前字符是后方括号、后花括号做如下处理：
			if ((key == ']') || (key == '}')) {
				// （1）后方括号、后花括号，的前面必须换行。打印：换行。
				result.append(NEW_LINE);
				// （2）每出现一次后方括号、后花括号；缩进次数减少一次。打印：缩进。
				number--;
				result.append(indent(number));
				// （3）打印：当前字符。
				result.append(key);
				// （4）如果当前字符后面还有字符，并且字符不为“，”，打印：换行。
				if (((i + 1) < length) && (json.charAt(i + 1) != ',')) {
					result.append(NEW_LINE);
				}
				// （5）继续下一次循环。
				continue;
			}

			// 4、如果当前字符是逗号。逗号后面换行，并缩进，不改变缩进次数。
			if ((key == ',')) {
				result.append(key);
				result.append(NEW_LINE);
				result.append(indent(number));
				continue;
			}
			// 5、打印：当前字符。
			result.append(key);
		}

		return result.toString();
	}
1345717
protected Article readArticleFromJson(String json) {
        Gson gson = new Gson();
        Article article = gson.fromJson(json, Article.class);
        return article;
    }
546950
public static <T> String toJson(T t) {
        if (Objects.isNull(t)) {
            log.warn("t is blank. ");
            return "";
        }
        try {
            return OBJECT_MAPPER.writeValueAsString(t);
        } catch (Exception e) {
            log.error(e.getMessage(), e);
            return "";
        }
    }
1156393
public JSONObject asJson() throws HelloSignException {
        JSONObject json = null;
        String response = getLastResponse();
        logger.debug("Response body: " + response);
        try {
            json = new JSONObject(response);
            validate(json);
        } catch (HelloSignException e) {
            throw e;
        } catch (JSONException e) {
            throw new HelloSignException(e);
        } finally {
            reset();
        }
        return json;
    }
35358
@SuppressWarnings("unchecked")
	public static <K,V> Map<K,V> jsonToMap(String json){
		return FastJsonKit.parse(json, HashMap.class);
	}
117295
String asJson( WebSocketMessage message ) {

		String result = null;
		try {
			ObjectMapper mapper = JSonBindingUtils.createObjectMapper();
			StringWriter writer = new StringWriter();
			mapper.writeValue( writer, message );
			result = writer.toString();

		} catch( IOException e ) {
			this.logger.severe( "A notification could not be prepared. It will not be sent. " + e.getMessage());
			Utils.logException( this.logger, e );
		}

		return result;
	}
206311
public static Search fromJson(String json) {
        try {
            return JsonSerializer.fromString(json, Search.class);
        } catch (Exception e) {
            String message = String.format("Unparseable JSON search: %s", e.getMessage());
            Log.error(e, message);
            throw new IllegalArgumentException(message, e);
        }
    }