public class MiniJSON
extends java.lang.Object
Modifier and Type | Class | Description |
---|---|---|
static class |
MiniJSON.JSONObject |
An official JSON object.
|
static class |
MiniJSON.MJSONException |
An official MiniJSON parsing exception.
|
Modifier and Type | Field | Description |
---|---|---|
static java.lang.Object |
NULL |
The official definition of "null" for a JSON object
|
Constructor | Description |
---|---|
MiniJSON() |
Modifier and Type | Method | Description |
---|---|---|
void |
fromJSONtoPOJO(MiniJSON.JSONObject jsonObj,
java.lang.Object o) |
Converts a json object to a pojo object.
|
void |
fromJSONtoPOJO(java.lang.String json,
java.lang.Object o) |
Converts a JSON document to a pojo object.
|
java.lang.String |
fromPOJOFieldtoJSON(java.lang.Class<?> type,
java.lang.Object val) |
Converts a pojo field to a JSON value.
|
java.lang.String |
fromPOJOtoJSON(java.lang.Object o) |
Converts a pojo object to a JSON document.
|
MiniJSON.JSONObject |
parseObject(java.lang.String doc) |
Given a string containing a JSON object, this method will parse it
into a mapped JSONObject object recursively.
|
static java.lang.String |
toJSONString(java.lang.String value) |
Given a normal string, this method will return a JSON-Safe
string, which means escaped crlf, escaped tabs and backslashes, etc.
|
public static final java.lang.Object NULL
public static java.lang.String toJSONString(java.lang.String value)
value
- the unsafe stringpublic MiniJSON.JSONObject parseObject(java.lang.String doc) throws MiniJSON.MJSONException
doc
- the JSON document that contains a top-level JSON objectMiniJSON.MJSONException
- the parse errorpublic java.lang.String fromPOJOFieldtoJSON(java.lang.Class<?> type, java.lang.Object val)
type
- the class typeval
- the valuepublic java.lang.String fromPOJOtoJSON(java.lang.Object o)
o
- the object to convertpublic void fromJSONtoPOJO(java.lang.String json, java.lang.Object o) throws MiniJSON.MJSONException
json
- the json documento
- the object to convertMiniJSON.MJSONException
- a parse exceptionpublic void fromJSONtoPOJO(MiniJSON.JSONObject jsonObj, java.lang.Object o) throws MiniJSON.MJSONException
jsonObj
- the json objecto
- the object to convertMiniJSON.MJSONException
- a parse exception