2 * Copyright (C) 2014 EBay Software Foundation
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 * Authors : Ashwin Raveendran
10 package org.opendaylight.ovsdb.lib.jsonrpc;
12 import com.fasterxml.jackson.core.JsonProcessingException;
13 import com.fasterxml.jackson.databind.ObjectMapper;
14 import com.fasterxml.jackson.databind.ObjectWriter;
17 public class JsonUtils {
19 static ObjectMapper mapper = new ObjectMapper();
21 static ObjectWriter prettyWriter = mapper.writerWithDefaultPrettyPrinter();
23 public static String prettyString(Object jsonNode){
25 return prettyWriter.writeValueAsString(jsonNode);
26 } catch (JsonProcessingException e) {
27 throw new RuntimeException(e);