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 {
15 private static final ObjectWriter PRETTY_WRITER = new ObjectMapper().writerWithDefaultPrettyPrinter();
21 public static String prettyString(final Object jsonNode) {
23 return PRETTY_WRITER.writeValueAsString(jsonNode);
24 } catch (JsonProcessingException e) {
25 throw new IllegalStateException(e);