public final class JsonUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static String |
jsonBool(boolean b)
Returns JSON literal value the given boolean value
|
static String |
jsonBool(Boolean v)
Returns JSON literal value the given boolean object
|
static String |
jsonDate(Date date)
There's no predefined format for Date objects in JSON
Here, just use a string in ISO format |
static String |
jsonNumber(Number v)
Returns JSON literal value for 'Number' instances (Byte, Short, Integer, Long, Float, Double, BigInteger, BigDecimal)
|
static String |
jsonObjectValue(Object obj)
Returns the JSON value of the given object
The supported objects are : String, Number, Boolean, Date (util/sql), Time, Timestamp, Character, StringBuffer |
static String |
jsonString(String sStdString)
Convert "Standard Java String" to "JSON String value"
A String value in JSON is just the string itself between quotes, with special characters protection ( \x ) |
public static String jsonString(String sStdString)
sStdString - :public static String jsonDate(Date date)
date - public static String jsonBool(boolean b)
b - public static String jsonBool(Boolean v)
v - public static String jsonNumber(Number v)
v - public static String jsonObjectValue(Object obj)
obj - RuntimeException - if the given object is an instance of an unsupported classCopyright © 2016. All rights reserved.