zoukankan      html  css  js  c++  java
  • EasyJson 发布

    JSON库很常用了,现在开源的JSON库也有很多。但是我们仍然面临下列问题

    1)时不时的爆出这个Json库出现漏洞,那个json库出现漏洞。一旦出现漏洞只能升级,想切换JSON都不成。

    2)一个项目中有多个JSON库(这个原因很多,但又不可避免),改Bug可能都得学习多种JSON库

    鉴于如上问题,开发了一套easyjson库,你可以把它看做是slf4j一样,它本身不做JSON的处理,可用它来讲任何的JSON进行适配到其他的JSON库上。

    它是基于此思路开发出来的。使用它,你的现有项目不需要做一行的代码改变即可在各个JSON库自如的切换。

    仓库地址Github EasyJSON

    关键特性:

    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, jackason

    easyjson facadeJSON 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 适配:

    JSON LibraryMavenversionAdapter
    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>
                    
  • 相关阅读:
    C# WPF开源控件库MaterialDesign介绍
    C# MQTT 服务端客户端通讯
    C#串口调试工具 (WPF/MVVM结构完整示例版)
    WPF转换器
    WPF动画基础及实例
    WPF MVVM架构 EF、WCF、IOC 设计示例经典
    SpringMVC中采用简洁的配置实现文件上传
    Maven 默认 SpringMVC-servlet.xml 基本配置
    maven pom.xml基本设置
    maven pom.xml设置jdk编译版本为1.8
  • 原文地址:https://www.cnblogs.com/f1194361820/p/11572138.html
Copyright © 2011-2022 走看看