/*
* Copyright (c) 2014, 2015 EBay Software Foundation and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
package org.opendaylight.ovsdb.lib.jsonrpc;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectWriter;
public class JsonUtils {
private static ObjectMapper mapper = new ObjectMapper();
private static ObjectWriter prettyWriter = mapper.writerWithDefaultPrettyPrinter();
private JsonUtils() {
}
public static String prettyString(Object jsonNode) {
try {
return prettyWriter.writeValueAsString(jsonNode);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
}
}