Fastjson Android version


Fastjson Android version

Fastjson provides the Android version. Compared with the standard version, the Android version removes some functions that are not supported by the Android virtual machine dalvik, making the jar smaller, and has done a lot for dalvik. Performance optimization, including reducing method calls, etc. When parse is JSONObject/JSONArray, it is faster than native org.json, and the serialization and deserialization JavaBean performance is better than jackson/gson.

Download

Via Maven:

<dependency>
    <groupId>com.alibaba</groupId>
    <artifactId>fastjson</artifactId>
    <version>VERSION_CODE</version>
</dependency>

or Gradle:

compile 'com.alibaba:fastjson:VERSION_CODE'

Replace VERSION_CODE with the real release version number here or here or here , for example 1.1.54.android

The bytecode format of the Dalvik virtual machine is different from that of Java SE. The current ASM dynamic optimization cannot be implemented on Android.

The Dalvik virtual machine on Android does not support awt, so the standard version of awt-related class serialization and deserialization support is removed.

AtomicXXX should not be used as a property of POJO and is not commonly used, so it has been removed in the Android version.

This function is used for web jsonp data generation and is not commonly used in android clients, so it is removed.

public abstract class JSON {
    public static parseObject(byte[] input, int off, int len, CharsetDecoder charsetDecoder, Type clazz,
                                      Feature... features) { ... }

    public static Object parse(byte[] input, int off, int len, CharsetDecoder charsetDecoder, 
                                      int features) {}

    public static Object parse(byte[] input, int off, int len, CharsetDecoder charsetDecoder, 
                                      Feature...features) {}

    public static Object parse(byte[] input, int off, int len, CharsetDecoder charsetDecoder, 
                                      int features) {}
}

// JSONSerializerMap已废弃,不支持
com.alibaba.fastjson.serializer.JSONSerializer.JSONSerializer(JSONSerializerMap)


com.alibaba.fastjson .parser.JavaBeanMapping Use com.alibaba.fastjson.parser.ParserConfig instead of com.alibaba.fastjson.serializer.JSONSerializerMap Use com.alibaba.fastjson.serializer.SerializeConfig instead of com.alibaba.fastjson.parser.DefaultExtJSONParser Use com.alibaba.fastjson .parser.DefaultJSONParser instead


class com.alibaba.fastjson.JSONWriter {
    @Deprecated
    public void writeStartObject();

    @Deprecated
    public void writeEndObject();

    @Deprecated
    public void writeStartArray();

    @Deprecated
    public void writeEndArray();
}