public final class JsonUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static String |
buildJson(Object jsonObj)
Returns a JSON string for the given object.
|
static void |
buildJson(Writer writer,
Object jsonObj)
Returns a JSON string for the given object.
|
static Object |
parseJson(Reader reader)
Parse the json string into a structure comprising only three types: a map, a list, and a scalar value.
|
static Object |
parseJson(String jsonStr)
Parse the json string into a structure comprising only three types: a map, a list, and a scalar value.
|
public static Object parseJson(String jsonStr) throws RestApiException
jsonStr - Input JSON string representing a map, a list, or an object/primitive type.RestApiException - if JSON parsing fails.public static Object parseJson(Reader reader) throws RestApiException, IOException
reader - Reader from which the input JSON string is to be read representing a map, a list, or an object/primitive type.RestApiException - if JSON parsing fails.IOException - if error occurs while reading from the reader.public static String buildJson(Object jsonObj) throws RestApiException
jsonObj - An object that is to be converted to JSON string.RestApiException - if JSON build fails.public static void buildJson(Writer writer, Object jsonObj) throws RestApiException, IOException
writer - Writer to which the generated JSON string is to be written. Cannot be null.jsonObj - An object that is to be converted to JSON string.RestApiException - if JSON build fails.IOException - if error occurs while writing to writer.Copyright © 2013. All rights reserved.