是否有可能调整空手道中的 json 输出?

Is there possibility to tweak the json output in karate?

是否可以将输出 1 调整为输出 2

*def dataset = databaseMethods.runJsonQuery(result, query) Then print dataset

输出 1 : [{"账号 :"123", "Key" : "9989"}, {"账号 :"345", "Key" : "9889"},{"账号 : “569”,“密钥”:“9989”}]

我需要的预期输出: { “记录集”:[ [{"账号:"123","Key":"9989"},{"账号:"345","Key":"9889"},{"账号:"569","Key": “9989”}] }

可以的话能给个解决办法吗

我正在做 POC 以适应我公司的集成(api + 数据库)自动化的空手道框架。

是的,阅读文档:https://github.com/intuit/karate#json-transforms

但这个具体案例很简单:

* def output2 = { "recordset": "#(output1)" }

另请注意,空手道几乎就像 JS,因此您甚至可以这样做。

* def output2 = {}
* output2.recordset = output1