public class ToJSONStringUtil
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static com.fasterxml.jackson.databind.JsonNode |
parseObjectToJsonNode(java.lang.Object fieldValue,
com.fasterxml.jackson.databind.ObjectMapper om)
Parses an object to JSON depending on the objects capabilities to express itself in JSON format or not.
|
static java.lang.String |
toJSONString(java.util.Map<java.lang.String,java.lang.Object> fields)
Util for transforming an object into a JSON string representation.
|
static java.lang.String |
toJSONString(java.lang.String rootName,
java.util.Map<java.lang.String,java.lang.Object> fields)
This method should be used with caution, as it introduces an additional layer for naming the object to serialize in json format with
rootName. |
public static java.lang.String toJSONString(java.util.Map<java.lang.String,java.lang.Object> fields)
fields - The map of object variables to be serialized as a json string.public static java.lang.String toJSONString(java.lang.String rootName,
java.util.Map<java.lang.String,java.lang.Object> fields)
rootName.
Thus, it introduces another layer in the object hierarchy.rootName - The name of the object.fields - The map of object variables to be serialized as a json string.public static com.fasterxml.jackson.databind.JsonNode parseObjectToJsonNode(java.lang.Object fieldValue,
com.fasterxml.jackson.databind.ObjectMapper om)
fieldValue - The object to be parsed.om - The object mapper that is to be used for parsing.