com.bazaarvoice.jolt
public class JsonUtils extends Object
| Constructor and Description |
|---|
JsonUtils() |
| Modifier and Type | Method and Description |
|---|---|
static Object |
cloneJson(Object json) |
static Map<String,Object> |
javason(String javason)
Utility for test classes, so that they can inline json in a test class.
|
static <T> T |
jsonTo(InputStream in,
com.fasterxml.jackson.core.type.TypeReference<T> typeRef) |
static Map<String,Object> |
jsonToMap(InputStream in) |
static Map<String,Object> |
jsonToMap(String json) |
static Object |
jsonToObject(InputStream in) |
static Object |
jsonToObject(String json) |
static void |
removeRecursive(Object json,
String keyToRemove)
Removes a key recursively from anywhere in a JSON document.
|
static String |
toJsonString(Object map) |
static String |
toPrettyJsonString(Object map) |
public static void removeRecursive(Object json, String keyToRemove)
json - the Jackson Object version of the JSON document
(contents changed by this call)keyToRemove - the key to remove from the documentpublic static Map<String,Object> javason(String javason) throws IOException
javason - Json-ish string you want to turn into Maps-of-MapsIOExceptionpublic static Map<String,Object> jsonToMap(String json) throws IOException
IOExceptionpublic static Object jsonToObject(String json) throws IOException
IOExceptionpublic static Object jsonToObject(InputStream in) throws IOException
IOExceptionpublic static Map<String,Object> jsonToMap(InputStream in) throws IOException
IOExceptionpublic static <T> T jsonTo(InputStream in, com.fasterxml.jackson.core.type.TypeReference<T> typeRef) throws IOException
IOExceptionpublic static String toJsonString(Object map) throws IOException
IOExceptionpublic static String toPrettyJsonString(Object map) throws IOException
IOExceptionCopyright © 2013. All Rights Reserved.