Package com.alibaba.fastjson
Class JSON
java.lang.Object
com.alibaba.fastjson.JSON
- All Implemented Interfaces:
JSONAware
- Direct Known Subclasses:
JSONArray
,JSONObject
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
addMixInAnnotations
(Type target, Type mixinSource) static void
static void
configFilter
(com.alibaba.fastjson2.JSONWriter.Context context, SerializeFilter filter) static com.alibaba.fastjson2.JSONReader.Context
createReadContext
(int featuresValue, Feature... features) static com.alibaba.fastjson2.JSONWriter.Context
createWriteContext
(SerializeConfig config, int featuresValue, SerializerFeature... features) static Type
getMixInAnnotations
(Type target) static boolean
static boolean
isValidArray
(String str) static boolean
isValidObject
(String str) static Object
parse
(byte[] input, int off, int len, CharsetDecoder charsetDecoder, int features) static Object
parse
(byte[] input, int off, int len, CharsetDecoder charsetDecoder, Feature... features) static Object
static Object
static Object
static Object
static Object
parse
(String str, ParserConfig config) static Object
parse
(String str, ParserConfig config, int features) static Object
parse
(String str, ParserConfig config, Feature... features) static JSONArray
parseArray
(String str) static JSONArray
parseArray
(String str, Feature... features) static <T> List<T>
parseArray
(String text, Class<T> type) static <T> List<T>
parseArray
(String text, Class<T> type, Feature... features) static <T> List<T>
parseArray
(String text, Class<T> clazz, ParserConfig config) parseArray
(String text, Type[] types) static <T> T
parseObject
(byte[] input, int off, int len, CharsetDecoder charsetDecoder, Type clazz, Feature... features) static <T> T
parseObject
(byte[] input, int off, int len, Charset charset, Type clazz, Feature... features) static <T> T
parseObject
(byte[] bytes, int offset, int len, Charset charset, Type objectType, ParserConfig config, ParseProcess processor, int featureValues, Feature... features) static <T> JSONObject
parseObject
(byte[] jsonBytes, Feature... features) static <T> T
parseObject
(byte[] jsonBytes, Type type, Feature... features) static <T> T
parseObject
(byte[] jsonBytes, Type type, SerializeFilter filter, Feature... features) static <T> T
parseObject
(byte[] bytes, Charset charset, Type objectClass, ParserConfig config, ParseProcess processor, int featureValues, Feature... features) static <T> T
parseObject
(char[] str, int length, Type objectType, Feature... features) static <T> T
parseObject
(char[] str, Class<T> objectClass, Feature... features) static <T> T
parseObject
(InputStream is, Class<T> objectType, Feature... features) static <T> T
parseObject
(InputStream is, Type objectType, Feature... features) static <T> T
parseObject
(InputStream is, Charset charset, Type objectType, Feature... features) static <T> T
parseObject
(InputStream is, Charset charset, Type objectType, ParserConfig config, ParseProcess processor, int featureValues, Feature... features) static <T> T
parseObject
(InputStream is, Charset charset, Type type, ParserConfig config, Feature... features) static JSONObject
parseObject
(String str) static JSONObject
parseObject
(String text, Feature... features) static <T> T
parseObject
(String str, TypeReference<T> typeReference, Feature... features) static <T> T
parseObject
(String str, Class<T> objectClass) static <T> T
parseObject
(String str, Class<T> objectClass, ParseProcess processor, Feature... features) static <T> T
parseObject
(String str, Class<T> objectType, Feature... features) static <T> T
parseObject
(String input, Type clazz, int featureValues, Feature... features) static <T> T
parseObject
(String str, Type objectType, ParseProcess processor, Feature... features) static <T> T
parseObject
(String str, Type objectType, Feature... features) static <T> T
parseObject
(String input, Type clazz, ParserConfig config, int featureValues, Feature... features) static <T> T
parseObject
(String str, Type objectClass, ParserConfig config, ParseProcess processor, int featureValues, Feature... features) static <T> T
parseObject
(String str, Type objectType, ParserConfig config, Feature... features) static void
removeMixInAnnotations
(Type target) static <T> T
toJavaObject
(JSON json, Class<T> clazz) <T> T
toJavaObject
(TypeReference<T> typeReference) abstract <T> T
toJavaObject
(Class<T> objectClass) abstract <T> T
toJavaObject
(Type type) static Object
static Object
toJSON
(Object javaObject, ParserConfig config) static Object
toJSON
(Object javaObject, SerializeConfig config) static byte[]
toJSONBytes
(Object object) static byte[]
toJSONBytes
(Object object, int defaultFeatures, SerializerFeature... features) static byte[]
toJSONBytes
(Object object, SerializeConfig config, int defaultFeatures, SerializerFeature... features) static byte[]
toJSONBytes
(Object object, SerializeConfig config, SerializeFilter[] filters, int defaultFeatures, SerializerFeature... features) static byte[]
toJSONBytes
(Object object, SerializeConfig config, SerializeFilter[] filters, String dateFormat, int defaultFeatures, SerializerFeature... features) static byte[]
toJSONBytes
(Object object, SerializeConfig config, SerializeFilter filter, SerializerFeature... features) static byte[]
toJSONBytes
(Object object, SerializeConfig config, SerializerFeature... features) static byte[]
toJSONBytes
(Object object, SerializeFilter filter) static byte[]
toJSONBytes
(Object object, SerializeFilter... filters) static byte[]
toJSONBytes
(Object object, SerializeFilter[] filters, SerializerFeature... features) static byte[]
toJSONBytes
(Object object, SerializeFilter filter, SerializerFeature... features) static byte[]
toJSONBytes
(Object object, SerializerFeature... features) static byte[]
toJSONBytes
(Charset charset, Object object, SerializeConfig config, SerializeFilter[] filters, String dateFormat, int defaultFeatures, SerializerFeature... features) static String
toJSONString
(Object object) static String
toJSONString
(Object object, boolean prettyFormat) static String
toJSONString
(Object object, int defaultFeatures, SerializerFeature... features) static String
toJSONString
(Object object, SerializeConfig config, SerializeFilter[] filters, SerializerFeature... features) static String
toJSONString
(Object object, SerializeConfig config, SerializeFilter[] filters, String dateFormat, int defaultFeatures, SerializerFeature... features) static String
toJSONString
(Object object, SerializeConfig config, SerializeFilter filter, SerializerFeature... features) static String
toJSONString
(Object object, SerializeConfig config, SerializerFeature... features) static String
toJSONString
(Object object, SerializeFilter[] filters, SerializerFeature... features) static String
toJSONString
(Object object, SerializeFilter filter0, SerializeFilter filter1, SerializeFilter... filters) static String
toJSONString
(Object object, SerializeFilter filter, SerializerFeature... features) static String
toJSONString
(Object object, SerializerFeature... features) static String
toJSONStringWithDateFormat
(Object object, String dateFormat, SerializerFeature... features) static String
toJSONStringZ
(Object object, SerializeConfig mapping, SerializerFeature... features) toString
(SerializerFeature... features) static final int
writeJSONString
(OutputStream os, Object object, int defaultFeatures, SerializerFeature... features) static final int
writeJSONString
(OutputStream os, Object object, SerializeFilter[] filters) static final int
writeJSONString
(OutputStream os, Object object, SerializeFilter[] filters, SerializerFeature... features) static final int
writeJSONString
(OutputStream os, Object object, SerializerFeature... features) static final int
writeJSONString
(OutputStream os, Charset charset, Object object, SerializeConfig config, SerializeFilter[] filters, String dateFormat, int defaultFeatures, SerializerFeature... features) static final int
writeJSONString
(OutputStream os, Charset charset, Object object, SerializerFeature... features) static void
writeJSONString
(Writer writer, Object object, int defaultFeatures, SerializerFeature... features) static void
writeJSONString
(Writer writer, Object object, SerializerFeature... features) void
writeJSONString
(Appendable appendable)
-
Field Details
-
VERSION
- See Also:
-
defaultTimeZone
-
defaultLocale
-
DEFAULT_TYPE_KEY
-
DEFFAULT_DATE_FORMAT
-
DEFAULT_PARSER_FEATURE
public static int DEFAULT_PARSER_FEATURE -
DEFAULT_GENERATE_FEATURE
public static int DEFAULT_GENERATE_FEATURE
-
-
Constructor Details
-
JSON
public JSON()
-
-
Method Details
-
createReadContext
public static com.alibaba.fastjson2.JSONReader.Context createReadContext(int featuresValue, Feature... features) -
parseObject
-
parseObject
-
parseObject
public static <T> T parseObject(byte[] bytes, Charset charset, Type objectClass, ParserConfig config, ParseProcess processor, int featureValues, Feature... features) -
parseObject
public static <T> T parseObject(byte[] bytes, int offset, int len, Charset charset, Type objectType, ParserConfig config, ParseProcess processor, int featureValues, Feature... features) -
parseObject
-
parseObject
-
parseObject
public static <T> T parseObject(String str, Type objectClass, ParserConfig config, ParseProcess processor, int featureValues, Feature... features) -
parseObject
public static <T> T parseObject(String input, Type clazz, ParserConfig config, int featureValues, Feature... features) -
parseObject
public static <T> T parseObject(String str, Type objectType, ParseProcess processor, Feature... features) -
parseObject
public static <T> T parseObject(String str, Class<T> objectClass, ParseProcess processor, Feature... features) -
parseObject
-
parseObject
-
parseObject
-
parseObject
-
parseObject
-
parseObject
public static <T> T parseObject(String str, Type objectType, ParserConfig config, Feature... features) - Since:
- 1.2.11
-
parseObject
public static <T> T parseObject(InputStream is, Type objectType, Feature... features) throws IOException - Throws:
IOException
-
parseObject
public static <T> T parseObject(InputStream is, Class<T> objectType, Feature... features) throws IOException - Throws:
IOException
-
parseObject
public static <T> T parseObject(InputStream is, Charset charset, Type objectType, ParserConfig config, ParseProcess processor, int featureValues, Feature... features) throws IOException - Throws:
IOException
-
parseObject
public static <T> T parseObject(InputStream is, Charset charset, Type type, ParserConfig config, Feature... features) throws IOException - Throws:
IOException
-
parseObject
public static <T> T parseObject(InputStream is, Charset charset, Type objectType, Feature... features) throws IOException - Throws:
IOException
-
parseObject
- Since:
- 2.0.7
-
parseObject
-
parseObject
public static <T> T parseObject(byte[] jsonBytes, Type type, SerializeFilter filter, Feature... features) -
parse
-
parse
-
parse
-
parse
-
parse
-
parse
-
parse
-
parse
public static Object parse(byte[] input, int off, int len, CharsetDecoder charsetDecoder, Feature... features) -
parse
public static Object parse(byte[] input, int off, int len, CharsetDecoder charsetDecoder, int features) -
parseObject
public static <T> T parseObject(byte[] input, int off, int len, CharsetDecoder charsetDecoder, Type clazz, Feature... features) -
parseObject
-
createWriteContext
public static com.alibaba.fastjson2.JSONWriter.Context createWriteContext(SerializeConfig config, int featuresValue, SerializerFeature... features) -
toJSONString
public static String toJSONString(Object object, SerializeConfig config, SerializeFilter[] filters, String dateFormat, int defaultFeatures, SerializerFeature... features) -
toJSONString
public static String toJSONString(Object object, SerializeConfig config, SerializeFilter[] filters, SerializerFeature... features) -
toJSONString
public static String toJSONString(Object object, SerializeFilter[] filters, SerializerFeature... features) -
configFilter
public static void configFilter(com.alibaba.fastjson2.JSONWriter.Context context, SerializeFilter filter) -
toJSONBytes
public static byte[] toJSONBytes(Object object, SerializeConfig config, SerializeFilter[] filters, int defaultFeatures, SerializerFeature... features) -
toJSONBytes
public static byte[] toJSONBytes(Object object, SerializeConfig config, SerializeFilter filter, SerializerFeature... features) -
toJSONBytes
public static byte[] toJSONBytes(Charset charset, Object object, SerializeConfig config, SerializeFilter[] filters, String dateFormat, int defaultFeatures, SerializerFeature... features) -
toJSONBytes
public static byte[] toJSONBytes(Object object, SerializeFilter[] filters, SerializerFeature... features) -
toJSONBytes
public static byte[] toJSONBytes(Object object, SerializeConfig config, SerializerFeature... features) -
toJSONString
-
toJSONString
-
toJSONString
public static String toJSONString(Object object, SerializeFilter filter0, SerializeFilter filter1, SerializeFilter... filters) -
toJSONString
-
toJSONBytes
-
toJSONBytes
-
toJSONBytes
-
toJSONBytes
-
toJSONBytes
public static byte[] toJSONBytes(Object object, SerializeFilter filter, SerializerFeature... features) -
toJSONBytes
public static byte[] toJSONBytes(Object object, SerializeConfig config, SerializeFilter[] filters, String dateFormat, int defaultFeatures, SerializerFeature... features) -
toJSONBytes
-
toJSONBytes
public static byte[] toJSONBytes(Object object, SerializeConfig config, int defaultFeatures, SerializerFeature... features) -
toJSONString
public static String toJSONString(Object object, SerializeConfig config, SerializerFeature... features) -
toJSONStringZ
public static String toJSONStringZ(Object object, SerializeConfig mapping, SerializerFeature... features) -
toJSONString
public static String toJSONString(Object object, SerializeConfig config, SerializeFilter filter, SerializerFeature... features) -
toJSONString
public static String toJSONString(Object object, SerializeFilter filter, SerializerFeature... features) -
toJSONString
public static String toJSONString(Object object, int defaultFeatures, SerializerFeature... features) -
toJSONStringWithDateFormat
public static String toJSONStringWithDateFormat(Object object, String dateFormat, SerializerFeature... features) -
writeJSONString
public static final int writeJSONString(OutputStream os, Object object, SerializerFeature... features) throws IOException - Throws:
IOException
-
writeJSONString
public static final int writeJSONString(OutputStream os, Object object, SerializeFilter[] filters) throws IOException - Throws:
IOException
-
writeJSONString
public static final int writeJSONString(OutputStream os, Charset charset, Object object, SerializerFeature... features) throws IOException - Throws:
IOException
-
writeJSONString
-
writeJSONString
public static void writeJSONString(Writer writer, Object object, int defaultFeatures, SerializerFeature... features) -
writeJSONString
public static final int writeJSONString(OutputStream os, Object object, int defaultFeatures, SerializerFeature... features) throws IOException - Throws:
IOException
-
writeJSONString
public static final int writeJSONString(OutputStream os, Charset charset, Object object, SerializeConfig config, SerializeFilter[] filters, String dateFormat, int defaultFeatures, SerializerFeature... features) throws IOException - Throws:
IOException
-
writeJSONString
public static final int writeJSONString(OutputStream os, Object object, SerializeFilter[] filters, SerializerFeature... features) throws IOException - Throws:
IOException
-
parseArray
-
parseArray
-
parseArray
-
parseArray
-
parseArray
-
isValid
-
isValidArray
-
isValidObject
-
toJavaObject
-
toJavaObject
-
toJavaObject
-
toJavaObject
-
toJSON
-
toJSON
-
toJSON
-
parseArray
-
addMixInAnnotations
-
removeMixInAnnotations
-
clearMixInAnnotations
public static void clearMixInAnnotations() -
getMixInAnnotations
-
toJSONString
- Specified by:
toJSONString
in interfaceJSONAware
- Returns:
- JSON text
-
toString
-
writeJSONString
-