groovy - 我有身份证清单。现在我想将它们存储在数组中以匹配 id
问题描述
Groovy Scripting中将数据存储在Array中的过程是什么
import groovy.json.JsonSlurper
def response = messageExchange.response.responseContent
def jsonsl = new JsonSlurper().parseText(response)
def count= jsonsl.photos.photo.size()
for(int i =0; i<count; i++)
{
log.info jsonsl.photos.photo[i].id
}
解决方案
如果您只想提取 ID,您应该能够:
def listOfIds = jsonl.protos.photo.id
但是如果没有一些示例 json response
,很难做到 100%
推荐阅读
- r - 在 R 中的简单线性回归中,我如何重新调整年龄以估计其每年/5 年/10 年的 beta 系数?
- html - 在引导程序上删除空格白色
- td-engine - TDengine数据库调试时如何记录sql命令?
- ios - SwiftUI 导航。推送后立即弹出视图。怎么修?
- elasticsearch - 没有写入时,为什么 Elasticsearch 每隔“n”秒执行一次索引?
- android - 前台服务中的静态变量
- node.js - mongo 对象 id 未在数组对象内部生成
- javascript - 无法通过 PUT 请求更新 mongodb 中的数据(Nodejs ExpressJS)
- leaflet - 在android应用程序上包装网络后找不到用户当前位置
- c# - 如何在绘画事件之前静态绘制线条?