public class JSONUtil extends Object
Modifier and Type | Field and Description |
---|---|
static char |
ARRAY_END |
static char |
ARRAY_START |
static char[] |
FALSE_CHARS |
static char[] |
HEX_CHARS |
static char |
NAME_SEPARATOR |
static char[] |
NULL_CHARS |
static char |
OBJECT_END |
static char |
OBJECT_START |
static char[] |
TRUE_CHARS |
static char |
VALUE_SEPARATOR |
Constructor and Description |
---|
JSONUtil() |
Modifier and Type | Method and Description |
---|---|
static String |
toJSON(Object o) |
static String |
toJSON(Object o,
int indentSize) |
static void |
unicodeEscape(int ch,
CharArr out) |
static void |
writeBoolean(boolean val,
CharArr out) |
static void |
writeChar(char ch,
CharArr out) |
static void |
writeNull(CharArr out) |
static void |
writeNumber(double number,
CharArr out) |
static void |
writeNumber(float number,
CharArr out) |
static void |
writeNumber(int number,
CharArr out) |
static void |
writeNumber(long number,
CharArr out) |
static void |
writeString(char[] val,
int start,
int end,
CharArr out) |
static void |
writeString(CharArr val,
CharArr out) |
static void |
writeString(CharSequence val,
int start,
int end,
CharArr out) |
static void |
writeString(String val,
int start,
int end,
CharArr out) |
static void |
writeStringPart(char[] val,
int start,
int end,
CharArr out) |
static void |
writeStringPart(CharSequence chars,
int start,
int end,
CharArr out) |
static void |
writeStringPart(String chars,
int start,
int end,
CharArr out) |
public static final char[] TRUE_CHARS
public static final char[] FALSE_CHARS
public static final char[] NULL_CHARS
public static final char[] HEX_CHARS
public static final char VALUE_SEPARATOR
public static final char NAME_SEPARATOR
public static final char OBJECT_START
public static final char OBJECT_END
public static final char ARRAY_START
public static final char ARRAY_END
public static String toJSON(Object o, int indentSize)
o
- The object to convert to JSONindentSize
- The number of space characters to use as an indent (default 2). 0=newlines but no spaces, -1=no indent at all.public static void writeNumber(int number, CharArr out)
public static void writeNumber(long number, CharArr out)
public static void writeNumber(float number, CharArr out)
public static void writeNumber(double number, CharArr out)
public static void writeString(char[] val, int start, int end, CharArr out)
public static void writeString(CharSequence val, int start, int end, CharArr out)
public static void writeStringPart(char[] val, int start, int end, CharArr out)
public static void writeChar(char ch, CharArr out)
public static void writeStringPart(CharSequence chars, int start, int end, CharArr out)
public static void unicodeEscape(int ch, CharArr out)
public static void writeNull(CharArr out)
public static void writeBoolean(boolean val, CharArr out)
Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.