While iterating map I am getting error. Followed with the below approach:
How to iterate through all values of a nested map in groovy
def deNull(root) { if (root instanceof List) { root.collect { if (it instanceof Map) { deNull(it) } else if (it instanceof List) { deNull(it) } } def map = [spring:[config:[activate:[on-profile:stage-release]]], test-property:stage] map = deNull(map) println map.inspect()
Error: startup failed: Script1.groovy: 9: illegal colon after argument expression; solution: a complex label expression before a colon must be parenthesized @ line 9, column 48. :[config:[activate:[on-profile:stage-rel ^ 1 error
I want output like below in key value pair. on-profile=stage test-property=stage