json - 有没有办法根据spring boot中的条件从JSON响应内容的JSON数组的匹配数组元素中省略某些字段
问题描述
但它应该保留与条件不匹配的其他数组元素中的字段。我有如下的json响应
{
"content": [
{
"someId": 1498,
"someKey": {
"anotherKey": "Not Specified",
"keyOne": "",
"keyTwo": null,
"keyThree": null
},
"date": "2009-09-11",
"time": "17:14",
"location": "Not Specified"
},
{
"someId": 1498,
"someKey": {
"anotherKey": "criteria",
"keyOne": "some data",
"keyTwo": "some data for key two",
"keyThree": "some data for key three"
},
"date": "2009-09-12",
"time": "17:15",
"location": "Not Specified"
},...
],
"pageable": {
"sort": {
"sorted": false,
"unsorted": true,
"empty": true
},
"offset": 0,
"pageSize": 10,
"pageNumber": 0,
"unpaged": false,
"paged": true
},
"totalElements": 10630,
"totalPages": 1063,
"last": false,
"size": 10,
"number": 0,
"sort": {
"sorted": false,
"unsorted": true,
"empty": true
},
"first": true,
"numberOfElements": 10,
"empty": false
}
当“anotherKey”值为“criteria”时,“keyOne”、“keyTwo”、“keyThree”应省略,否则应保留。有什么解决办法吗?提前致谢
解决方案
推荐阅读
- primefaces - 如何禁用 p:overlayPanel 的定位?
- c++ - 如何在 N-Api Addon C 中解决 Node.js Promise
- android - TFLite Interpreter 无法在 Android 上加载量化模型
- vb.net - 需要代理身份验证
- php - 如何分配字符串的连续重复值?PHP
- android - 列表不能转换为我的扩展列表的类。为什么?
- cron - Openssl 命令不会仅针对特定证书在 crontab 中运行
- python - 如何获取记录第一次更改的索引数据框
- sql-server - 在 SQL 中删除单个记录需要花费大量时间
- reactjs - 使用 TypeScript 动态格式化反应表中的标题