1 package com.atlassian.plugins.rest.doclet.generators.resourcedoc;
2
3 import org.codehaus.jackson.map.ObjectMapper;
4 import org.codehaus.jackson.map.SerializationConfig;
5
6 import java.io.IOException;
7
8 public class JsonOperations
9 {
10 private final static ObjectMapper objectMapper = new ObjectMapper();
11
12 static
13 {
14 objectMapper.configure(SerializationConfig.Feature.WRITE_NULL_PROPERTIES, false);
15 }
16
17 public static String toJson(Object bean)
18 {
19 try
20 {
21 return objectMapper.writeValueAsString(bean);
22 }
23 catch (IOException e)
24 {
25 throw new RuntimeException(e);
26 }
27 }
28 }