响应json去除参数值为空的参数-springboot配置
1.添加jackson相关依赖
<!--jackson 开始-->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<!--jackson 结束-->
2.添加如下配置
/**
* @Author dinghaifeng(丁海峰)
* @Date 2018/11/8
* @Time 17:40
* @Discription 不显示空参数的配置
*/
@Configuration
public class JsonConfig {
@Bean
@Primary
@ConditionalOnMissingBean(ObjectMapper.class)
public ObjectMapper jacksonObjectMapper(Jackson2ObjectMapperBuilder builder){
ObjectMapper objectMapper = builder.createXmlMapper(false).build();
objectMapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY);
return objectMapper;
}
}
响应json去除参数值为空的参数-springboot配置的更多相关文章
- 判断json数据是否为空
json数据是没有length这个属性的 ,所以不能直接用.length()方法 我们可以先遍历,然后根据遍历次数求长度 1.在IE上这样遍历json:(js代码) var jsonLength = ...
- 值不能为 null 或为空。参数名: linkText
“/”应用程序中的服务器错误. 值不能为 null 或为空.参数名: linkText 说明: 执行当前 Web 请求期间,出现未经处理的异常.请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的 ...
- (转) 值不能为空。参数名viewinfo(microsoft.sqlserver.management.sqlstudio.explorer)
打开MSSQL 2008 R2的时候,展开数据库都显示以下的错误提示: 值不能为空.参数名viewinfo(microsoft.sqlserver.management.sqlstudio.explo ...
- MSSQL2008 数据库展开报错:值不能为空。 参数名: viewInfo (Microsoft.SqlServer.Management.SqlStudio.Explorer)
今天打开数据库,结果出现:值不能为空. 参数名: viewInfo (Microsoft.SqlServer.Management.SqlStudio.Explorer) 百度之后找到其中一种解决方案 ...
- springmvc 怎么响应json数据
springmvc 怎么响应json数据@Controller@RequestMapping("/items") class ItemsController{ @RequestM ...
- 打开MSSQL 2008 R2的时候,展开数据库都显示以下的错误提示: 值不能为空。参数名viewinfo(microsoft.sqlserver.management.sqlstudio.explorer)
打开MSSQL 2008 R2的时候,展开数据库都显示以下的错误提示: 值不能为空.参数名viewinfo(microsoft.sqlserver.management.sqlstudio.explo ...
- Vue 2.0 v-for 响应式key, index及item.id参数对v-bind:key值造成差异研究
Vue 2.0 v-for 响应式key, index及item.id参数对v-bind:key值造成差异研究 在github上阅览README.md以获得最佳阅读体验,点这里 v-for响应式key ...
- 获取Json对象的长度以及判断json对象是否为空
(如有错敬请指点,以下是我工作中遇到并且解决的问题) = = = = = = = = = = = = = = = = 获取Json对象的长度 = = = = = = = = = = = = = = ...
- vs2015 建立项目报错:值不能为空,参数名:path1的错误解决与“未将对象引用到对象的实例”
“值不能为空,参数名:path1” 的错误.原因就是安卓sdk的路径不正确. 最简单的解决办法如下: 找到C:\Program Files (x86)\Android\android-sdk.进入文件 ...
随机推荐
- python实现的简单点对点(p2p)聊天
点对点聊天首先是基于多线程的网络编程,其次就是将每一个连接都保存为一个具有独一属性的对象并添加到连接列表中,对于每一个连接对象发送过来的信息必须要包含主要的三项内容(from,to,messages) ...
- Anaconda 的基本使用
Anaconda常用的Python版本管理工具和Python包管理软件,conda是Anaconda中的具体管理工具,下载地址为: https://www.anaconda.com/distribut ...
- Android Hook框架adbi源码浅析(一)
adbi(The Android Dynamic Binary Instrumentation Toolkit)是一个Android平台通用hook框架,基于动态库注入与inline hook技术实现 ...
- php经典算法实现(转)
<? //-------------------- // 基本数据结构算法 //-------------------- //二分查找(数组里查找某个元素) function bin_s ...
- ldd 查看程序依赖库
ldd 查看程序依赖库 https://linuxtools-rst.readthedocs.io/zh_CN/latest/tool/ldd.html
- web.net用户控件
1.它是以 Control注册 <%@ Control Language="C#" AutoEventWireup="true" CodeBehind=& ...
- stringify在苹果电脑下的值不能为空
sessionStorage.channel = JSON.stringify( );苹果的safari不接受stringify里面为空 火桑飘零ご 2018/1/25 20:21:49 wind ...
- 为什么会用let that=this
问题一:不知道楼主有没有接触过jquery jquery里边有一个特别典型的例子能说明用_this的作用$("#btn").click(function(){ var _this ...
- 人工智能之KNN算法
转载自:https://www.cnblogs.com/magic-girl/p/python-kNN.html 基于python实现的KNN算法 邻近算法(k-NearestNeighbor) 是机 ...
- Automatic Text Difficulty Classifier Assisting the Selection Of Adequate Reading Materials For European Portuguese Teaching --paper
the system uses existing Natural Language Processing (NLP) tools, a parser and an hyphenator, and tw ...