zoukankan      html  css  js  c++  java
  • JSON对应的maven依赖包

    常用有三种json解析jackson、fastjson、gson。

    1. jackson依赖包

      		<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
      	<dependency>
      	    <groupId>com.fasterxml.jackson.core</groupId>
      	    <artifactId>jackson-databind</artifactId>
      	    <version>2.9.3</version>
      	</dependency>
      	<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
      	<dependency>
      	    <groupId>com.fasterxml.jackson.core</groupId>
      	    <artifactId>jackson-core</artifactId>
      	    <version>2.9.3</version>
      	</dependency>
      	<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-annotations -->
      	<dependency>
      	    <groupId>com.fasterxml.jackson.core</groupId>
      	    <artifactId>jackson-annotations</artifactId>
      	    <version>2.9.3</version>
      	</dependency>
      
    2. fastjson

      <!-- https://mvnrepository.com/artifact/com.alibaba/fastjson -->
      <dependency>
          <groupId>com.alibaba</groupId>
          <artifactId>fastjson</artifactId>
          <version>1.2.47</version>
      </dependency>
      

      遇到对象转json字符串时,如果对象中的属性字段为null,则不会显示出来。解决方法

      JSONObject.toJSONString(bean,SerializerFeature.WriteMapNullValue)

    3. gson

      <!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
      <dependency>
          <groupId>com.google.code.gson</groupId>
          <artifactId>gson</artifactId>
          <version>2.8.2</version>
      </dependency>
      
      
  • 相关阅读:
    How to print GETDATE() in SQL Server with milliseconds in time?
    StarLink卫星网络如何工作
    Chinasat16
    天线增益计算
    Schemachine
    源代码之整洁代码
    关于进程内缓存与分布式缓存
    IOT物联网时代测试演化
    互联网大促运维实践案例
    Kubernetes应用场景
  • 原文地址:https://www.cnblogs.com/30go/p/8929898.html
Copyright © 2011-2022 走看看