Class JsonWriter
- java.lang.Object
-
- com.smartgridready.communicator.common.helper.JsonBase
-
- com.smartgridready.communicator.common.helper.JsonWriter
-
public class JsonWriter extends JsonBase
Converts data to JSON.
-
-
Field Summary
-
Fields inherited from class com.smartgridready.communicator.common.helper.JsonBase
keywordMapInput, objectMapper
-
-
Constructor Summary
Constructors Constructor Description JsonWriter(java.util.Map<java.lang.String,java.lang.String> keywordMapInput)Constructs a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.fasterxml.jackson.databind.JsonNodebuildJsonNode(java.util.Collection<java.util.Map<java.lang.String,java.lang.Object>> flatDataRecords)Builds a JSON node from a list of key-value pairs.java.lang.StringbuildJsonString(java.util.Collection<java.util.Map<java.lang.String,java.lang.Object>> flatDataRecords)Builds a JSON string from a list of key-value pairs.
-
-
-
Method Detail
-
buildJsonString
public java.lang.String buildJsonString(java.util.Collection<java.util.Map<java.lang.String,java.lang.Object>> flatDataRecords) throws com.fasterxml.jackson.core.JsonProcessingExceptionBuilds a JSON string from a list of key-value pairs.- Parameters:
flatDataRecords- the key-value pairs- Returns:
- a string
- Throws:
com.fasterxml.jackson.core.JsonProcessingException- when a key-value pair cannot be encoded
-
buildJsonNode
public com.fasterxml.jackson.databind.JsonNode buildJsonNode(java.util.Collection<java.util.Map<java.lang.String,java.lang.Object>> flatDataRecords) throws com.fasterxml.jackson.core.JsonProcessingExceptionBuilds a JSON node from a list of key-value pairs.- Parameters:
flatDataRecords- the key-value pairs- Returns:
- a JSON node
- Throws:
com.fasterxml.jackson.core.JsonProcessingException- when a key-value pair cannot be encoded
-
-