public class JsonUtils extends Object
Constructor and Description |
---|
JsonUtils() |
Modifier and Type | Method and Description |
---|---|
static Object |
jsonConvertFrom(Map<String,Class<?>> conversionMap,
String json)
convert an object from json.
|
static Object |
jsonConvertFrom(String json,
Class<?> theClass)
convert an object from json.
|
static String |
jsonConvertTo(Object object)
convert an object to json.
|
static void |
jsonConvertTo(Object object,
Writer writer)
convert an object to json.
|
static String |
jsonConvertToNoWrap(Object object)
convert an object to json without wrapping it with the simple class name.
|
static void |
main(String[] args) |
public static Object jsonConvertFrom(Map<String,Class<?>> conversionMap, String json)
conversionMap
- is the class simple name to class of objects which are allowed to be brought back.
Note: only the top level object needs to be registeredjson
- public static Object jsonConvertFrom(String json, Class<?> theClass)
json
- is the json string, not wrapped with a simple class nametheClass
- is the class that the object should be coverted into.
Note: only the top level object needs to be registeredpublic static String jsonConvertTo(Object object)
object
- public static void jsonConvertTo(Object object, Writer writer)
object
- writer
- public static String jsonConvertToNoWrap(Object object)
object
- public static void main(String[] args)
args
- Copyright © 2016 Internet2. All rights reserved.