JSON库很经常使用了,如今开源的JSON库也有不少。可是咱们仍然面临下列问题android
1)时不时的爆出这个Json库出现漏洞,那个json库出现漏洞。一旦出现漏洞只能升级,想切换JSON都不成。git
2)一个项目中有多个JSON库(这个缘由不少,但又不可避免),改Bug可能都得学习多种JSON库github
鉴于如上问题,开发了一套easyjson库,你能够把它看作是slf4j同样,它自己不作JSON的处理,可用它来说任何的JSON进行适配到其余的JSON库上。json
它是基于此思路开发出来的。使用它,你的现有项目不须要作一行的代码改变便可在各个JSON库自如的切换。eclipse
仓库地址:Github EasyJSONide
关键特性:学习
目前支持将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> |