Current version of 1.0.3
is product ready.
Fastjson-replacement
is a Bridge Pattern for developers or lagency projects which are used to Fastjson
usage to replace
Fastjson
implementation with Jackson
implementation.
- support
java.util.Date
,java 8 jsr310 time packages
(LocalDate
,LocalDateTime
,LocalTime
) - support multiple Date Format Deserialize(Current:
yyyy-MM-dd HH:mm:ss
,yyyy-MM-dd
)
Why do we need replace fastjson
? For it security issues, late of fix period and so on.
Why make new tools instead of using existing one? Because their bad tests(even in fastjson), and not auto publish after merged my pull requests that make me can not get new fix version from maven central repository.
Step 1: Add Dependencies
Use default jackson
version(current version is:1.12.3
) proivded by current lib.
maven
<dependency>
<groupId>io.github.qingmo</groupId>
<artifactId>fastjson-replacement</artifactId>
<version>1.0.3</version>
</dependency>
gradle
implementation("io.github.qingmo:fastjson-replacement:1.0.3")
Use custom jackson
version defined by user's project
maven
<dependency>
<groupId>io.github.qingmo</groupId>
<artifactId>fastjson-replacement</artifactId>
<version>1.0.3</version>
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson</groupId>
<artifactId>jackson-bom</artifactId>
</exclusion>
</exclusions>
</dependency>
gradle
implementation("io.github.qingmo:fastjson-replacement:1.0.3") {
exclude(group = "com.fasterxml.jackson.core")
exclude(group = "com.fasterxml.jackson")
}
Step 2: Replace fastjson
packages
Replace method
import com.alibaba.fastjson.JSON
replace with
import io.github.qingmo.json.JSON
import com.alibaba.fastjson.JSONArray
replace with
import io.github.qingmo.json.JSONArray
import com.alibaba.fastjson.JSONObject
replace with
import io.github.qingmo.json.JSONObject
-
Reliability
The system/library must work correctly.
Fastjson-replacement
provide functions with 100% tests coverage. -
Performance
The system/library must perform the function at the desired level of performance. if this library is the only solution to a problem, the performance should be at tolerant level; if this library is another solution to a problem, the performance should be equal to or better than the average level.
Fastjson-replacement
provide benchmark records as below(base on json-comparsion):
-
not support kotin data class
kotlin data class need
jackson-module-kotlin
which depends on kotlin-reflect bad benchmark scores in deserialize. i'm waiting for FasterXML/jackson-module-kotlin#439