public class DXJSON extends Object
Modifier and Type | Class and Description |
---|---|
static class |
DXJSON.ArrayBuilder
Builder class that generates a JSON array.
|
static class |
DXJSON.ObjectBuilder
Builder class that generates a JSON object (hash).
|
Modifier and Type | Method and Description |
---|---|
static DXJSON.ArrayBuilder |
getArrayBuilder()
Creates a new ArrayBuilder, initialized to produce an empty array.
|
static DXJSON.ObjectBuilder |
getObjectBuilder()
Creates a new ObjectBuilder, initialized to produce an empty object.
|
static com.fasterxml.jackson.databind.JsonNode |
parseJson(String stringified)
Parses the specified string into a JSON object.
|
static <T> T |
safeTreeToValue(com.fasterxml.jackson.databind.JsonNode json,
Class<T> valueType)
Translates the given JSON object to an instance of the specified class.
|
public static com.fasterxml.jackson.databind.JsonNode parseJson(String stringified) throws IOException
IOException
public static DXJSON.ArrayBuilder getArrayBuilder()
public static DXJSON.ObjectBuilder getObjectBuilder()
public static <T> T safeTreeToValue(com.fasterxml.jackson.databind.JsonNode json, Class<T> valueType)
This is a wrapper around Jackson's treeToValue
that suppresses
JsonProcessingException
and rethrows it as an unchecked exception.
json
- JSON objectvalueType
- A Jackson-deserializable classklass
Copyright © 2023. All Rights Reserved.