private String prettyPrintIfJson(String maybeJson) {
		JsonFactory factory = new JsonFactory();
		ObjectMapper mapper = new ObjectMapper(factory);
		TypeReference<HashMap<String,Object>> typeRef = new TypeReference<HashMap<String,Object>>() {};
		try {
			return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(mapper.readValue(maybeJson, typeRef));
		}
		catch (IOException e) {
			// Not JSON? Return unchanged
			return maybeJson;
		}
	}
Http commands.

@author Jon Brisbin
@author Ilayaperumal Gopinathan
@author Gunnar Hillert
@author Eric Bottard
@author David Turanski
spring-xd-shell/src/main/java/org/springframework/xd/shell/command/HttpCommands.java