public class JsonConverter extends Object
Class which encapsulates methods for converting JSON.
Constructor and Description |
---|
JsonConverter()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
com.fasterxml.jackson.databind.ObjectMapper |
getMapper()
Getter for mapper.
|
com.fasterxml.jackson.databind.JsonNode |
toNode(String json)
Parse the JSON string into a
JsonNode object. |
com.fasterxml.jackson.databind.JsonNode |
toNode(String json,
String field)
Parse the JSON string into a
JsonNode object with the specified field as
root field. |
public JsonConverter()
Default constructor. Initializes the
ObjectMapper
needed for
converting objects.
public com.fasterxml.jackson.databind.ObjectMapper getMapper()
Getter for mapper.
public com.fasterxml.jackson.databind.JsonNode toNode(String json)
Parse the JSON string into a JsonNode
object.
json
- the JSON contentJsonNode
objectpublic com.fasterxml.jackson.databind.JsonNode toNode(String json, String field)
Parse the JSON string into a JsonNode
object with the specified field as
root field.
json
- the JSON contentfield
- the field in the JSON to become the rootJsonNode
object with the specified field as root.Copyright © 2016. All rights reserved.