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>
      
      
  • 相关阅读:
    The user specified as a definer (”@’%') does not exist解决方法
    mongodb下载地址
    镜像系统,超好用
    部署mysql后,无法设置用户远程登陆(%只所有用户,不可以,只能给指定的ip?)
    Libcap的简介及安装
    GCC命令基础
    gcc安装(centos)
    React Native 踩坑
    webpack 和 babel
    React 开发笔记
  • 原文地址:https://www.cnblogs.com/30go/p/8929898.html
Copyright © 2011-2022 走看看