jsonslurper

Groovy compare two json with unknown nodes names and values

假如想象 提交于 2019-11-29 15:08:44
问题 I have a rest API to test and I have to compare two json responses. Below you can find a structure of the file. Both files to compare should contains the same elements but order might be different. Unfortunately the names, the type (simple, array) and the number of keys (root, nodeXYZ) are also not known. {"root": [{ "node1": "value1", "node2": "value1", "node3": [ { "node311": "value311", "node312": "value312" }, { "node321": "value321", "node322": "value322" } ], "node4": [ { "node411":