JsonUtil { public static String writeValueAsString(Object obj) throws IOException { return objectMapper.writeValueAsString(obj); }  static ObjectMapper getObjectMapper(); static JsonNode readTree(String str); static JsonNode readTree(File src); static T readValue(File src, Class<T> valueType); static T readValue(URL src, Class<T> valueType); static T readValue(Reader src, Class<T> valueType); static T readValue(JsonNode node, Class<T> valueType); static T readValue(String src, Class<T> valueType); static T readValue(InputStream src, Class<T> valueType); static T convertValue(Object fromValue, Class<T> valueType); static String writeValueAsString(Object obj); static Map jsonToMap(String str); static Parameters jsonToParameters(String str);  }
@Test public void mapToJson() throws Exception { Parameters parameters = new ParametersMap(); parameters.put("name", "value"); assertEquals("{\"name\":\"value\"}", JsonUtil.writeValueAsString(parameters)); }