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