EasyJson 發佈

JSON庫很經常使用了,如今開源的JSON庫也有不少。可是咱們仍然面臨下列問題android

1)時不時的爆出這個Json庫出現漏洞,那個json庫出現漏洞。一旦出現漏洞只能升級,想切換JSON都不成。git

2)一個項目中有多個JSON庫(這個緣由不少,但又不可避免),改Bug可能都得學習多種JSON庫github

 

鑑於如上問題,開發了一套easyjson庫,你能夠把它看作是slf4j同樣,它自己不作JSON的處理,可用它來說任何的JSON進行適配到其餘的JSON庫上。json

它是基於此思路開發出來的。使用它,你的現有項目不須要作一行的代碼改變便可在各個JSON庫自如的切換。eclipse

 

倉庫地址Github EasyJSONide

關鍵特性:學習

  1. Supports gson, fastjson, jackson, Progsbase ...
  2. Supports tree model, stream model
  3. Control whether serialize null
  4. Convert ON|OFF, 1|0 to Boolean
  5. Serialize or deserialize a Enum based on custom field
  6. Serialize or deserialize a Date using specified pattern | date format
  7. Supports custom exclusion rule, for examples: @Ignore, transient, specified modifier ...
  8. Get the JSONBuilder with zero configuration
  9. Switch the underlying implement without any code change
  10. Supports JDK 1.6+

 

目前支持將JSON庫適配給fastjson, gson, jackasonui

easyjson facade JSON Implementation
<dependency>
    <groupId>com.github.fangjinuo.easyjson</groupId>
    <artifactId>easyjson-core</artifactId>
    <version>${version}/version>
</dependency>
                
<dependency>
    <groupId>com.github.fangjinuo.easyjson</groupId>
    <artifactId>easyjson-gson</artifactId>
    <version>${version}/version>
</dependency>
                
<dependency>
    <groupId>com.github.fangjinuo.easyjson</groupId>
    <artifactId>easyjson-jackson</artifactId>
    <version>${version}/version>
</dependency>
                
<dependency>
    <groupId>com.github.fangjinuo.easyjson</groupId>
    <artifactId>easyjson-fastjson</artifactId>
    <version>${version}/version>
</dependency>
                

 

同時也支持將這些JSON經過easyjson 適配:google

JSON Library Maven version Adapter
Android json
<dependency>
    <groupId>com.vaadin.external.google</groupId>
    <artifactId>android-json</artifactId>
    <version>0.0.20131108.vaadin1</version>
</dependency>
                
0.0.20131108.vaadin
<dependency>
    <groupId>com.github.fangjinuo.easyjson</groupId>
    <artifactId>android-to-easyjson</artifactId>
    <version>${version}</version>
</dependency>
                
fastjson
<dependency>
    <groupId>com.alibaba</groupId>
    <artifactId>fastjson</artifactId>
    <version>1.2.58</version>
</dependency>
                
1.2.58
<dependency>
    <groupId>com.github.fangjinuo.easyjson</groupId>
    <artifactId>fastjson-to-easyjson</artifactId>
    <version>${version}</version>
</dependency>
                
json-lib
<dependency>
    <groupId>com.hynnet</groupId>
    <artifactId>json-lib</artifactId>
    <version>2.4</version>
</dependency>
                
2.4
<dependency>
    <groupId>com.github.fangjinuo.easyjson</groupId>
    <artifactId>jsonlib-to-easyjson</artifactId>
    <version>${version}</version>
</dependency>
                
json-smart
<dependency>
    <groupId>net.minidev</groupId>
    <artifactId>json-smart</artifactId>
    <version>2.3</version>
</dependency>
                
2.3
<dependency>
    <groupId>com.github.fangjinuo.easyjson</groupId>
    <artifactId>jsonsmart-to-easyjson</artifactId>
    <version>${version}</version>
</dependency>
                
Eclipse minimal-json
<dependency>
    <groupId>com.eclipsesource.minimal-json</groupId>
    <artifactId>minimal-json</artifactId>
    <version>0.9.5</version>
</dependency>
                
0.9.5
<dependency>
    <groupId>com.github.fangjinuo.easyjson</groupId>
    <artifactId>minimaljson-to-easyjson</artifactId>
    <version>${version}</version>
</dependency>
                
org.json
<dependency>
    <groupId>org.json</groupId>
    <artifactId>json</artifactId>
    <version>20180813</version>
</dependency>
                
20180813
<dependency>
    <groupId>com.github.fangjinuo.easyjson</groupId>
    <artifactId>orgjson-to-easyjson</artifactId>
    <version>${version}</version>
</dependency>
                
Progsbase JSON
<dependency>
    <groupId>com.progsbase.libraries</groupId>
    <artifactId>JSON</artifactId>
    <version>0.3.9</version>
</dependency>
                
0.3.9
<dependency>
    <groupId>com.github.fangjinuo.easyjson</groupId>
    <artifactId>progsbase-to-easyjson</artifactId>
    <version>${version}</version>
</dependency>
                
json-simple
<dependency>
    <groupId>com.googlecode.json-simple</groupId>
    <artifactId>json-simple</artifactId>
    <version>1.1.1</version>
</dependency>
                
1.1.1
<dependency>
    <groupId>com.github.fangjinuo.easyjson</groupId>
    <artifactId>simplejson-to-easyjson</artifactId>
    <version>${version}</version>
</dependency>
                
相關文章
相關標籤/搜索