public class JSON extends Object implements Serializable
| Modifier and Type | Field and Description |
|---|---|
static String |
BLANKS |
static String |
BLANKSTR |
protected static boolean |
ESCAPE_SOLIDUS |
static int |
INCR |
static int |
LN_CNTR |
static int |
LN_OFFSET |
| Constructor and Description |
|---|
JSON() |
| Modifier and Type | Method and Description |
|---|---|
protected static String |
cleanUpString(Object obj)
Provides special formatting of embedded characters to enable valid JSON
serialization
|
static void |
escapeSolidus(boolean set)
Use to set or unset escaping solidus characters in the output.
|
protected static String |
expandUnicode(String input)
Expands the input String content to unicode sequences for non ASCII characters
|
protected static Object |
getNumber(Double dNum,
String value)
Parses the number corresponding with the supplied values.
|
static boolean |
isValidObject(Object object)
Used to determine if the supplied Object can be a valid JSON object.
|
static boolean |
isValidType(Class<?> clazz)
Used to determine in the supplied Class is a valid type for JSON objects.
|
static JSONArtifact |
parse(InputStream is)
Parses the supplied input stream to produce either a
JSONObject or
a JSONArray. |
static JSONArtifact |
parse(Reader reader)
Parses the supplied reader to produce either a
JSONObject or a
JSONArray |
static JSONArtifact |
parse(String str)
Parses a supplied String to produce a
JSONObject or a
JSONArray. |
static void |
setSpacing(int size)
Provides a String of blanks for indentation (up to 60 spaces)
corresponding to the supplied indentation size.
|
public static String BLANKS
public static String BLANKSTR
protected static boolean ESCAPE_SOLIDUS
public static int INCR
public static int LN_CNTR
public static int LN_OFFSET
protected static String cleanUpString(Object obj)
obj - Object to be formattedpublic static void escapeSolidus(boolean set)
set - If true, solidus is printed as \/ rather than /protected static String expandUnicode(String input)
input - String to be formattedpublic static boolean isValidObject(Object object)
object - Object to be tested.public static boolean isValidType(Class<?> clazz)
String, Boolean, Integer,
Double, Long, Byte, Short, Float,
JSONObject, or JSONArrayclazz - The Class to be tested.public static JSONArtifact parse(InputStream is) throws IOException
JSONObject or
a JSONArray.is - The input stream to be parsed.JSONObject or the JSONArray parsed from the
input stream.IOException - If a parsing error occurs.public static JSONArtifact parse(Reader reader) throws IOException
JSONObject or a
JSONArrayreader - The reader to be parsed.JSONObject or the JSONArray parsed from the
reader.IOException - If a parsing error occurs.public static JSONArtifact parse(String str) throws IOException
JSONObject or a
JSONArray.str - Supplied String to be parsed.JSONObject or JSONArrayIOException - If a parsing error occurs.public static void setSpacing(int size)
size - the desired indentation size.Copyright © 2020. All rights reserved.