public class JSONUtil extends Object implements javax.ws.rs.ext.ContextResolver<com.fasterxml.jackson.databind.ObjectMapper>
| Constructor and Description |
|---|
JSONUtil() |
| Modifier and Type | Method and Description |
|---|---|
com.fasterxml.jackson.databind.ObjectMapper |
getContext(Class<?> type)
Get the ObjectMapper by given class type
|
Object |
JSONtoPOJO(String jsonfile,
Class<?> type)
Convert given JSON file to Redfish model (java object)
|
List<Object> |
JSONtoPOJOList(String jsonfile,
Class<?> type)
Convert given JSON file to Redfish model (java object)
|
void |
POJOtoJSON(String filename,
Object obj)
Convert given Redfish model (java object) to JSON and write as .json file
|
void |
PrettyPrint(Object model)
Pretty Print Redfish model by given resource POJO
|
String |
PrettyPrintString(Object model)
Pretty Print Redfish model by given resource POJO
|
void |
setDateFormat(DateFormat dateFormat)
Set the date format for JSON (de)serialization with Date properties.
|
public void setDateFormat(DateFormat dateFormat)
public com.fasterxml.jackson.databind.ObjectMapper getContext(Class<?> type)
getContext in interface javax.ws.rs.ext.ContextResolver<com.fasterxml.jackson.databind.ObjectMapper>public void PrettyPrint(Object model)
model - : print Redfish model (POJO) as JSON format to view data.public String PrettyPrintString(Object model)
model - : print Redfish model (POJO) as JSON format to view data.String Pretty Print JSON format Stringpublic Object JSONtoPOJO(String jsonfile, Class<?> type)
jsonfile - : Input JSON file which you want convert to Java Objecttype - : Class type of converted target Java Objectpublic List<Object> JSONtoPOJOList(String jsonfile, Class<?> type)
jsonfile - : Input JSON file which top level represents an array and you want convert to Java Objecttype - : Class type of converted target Java ObjectCopyright © 2017. All rights reserved.