Groovy: isn’t there a stringToMap out of the box?
You might want to try a few of your scenarios using evaluate, it might do what you are looking for. def stringMap = “[‘a’:2,’b’:4]” def map = evaluate(stringMap) assert map.a == 2 assert map.b == 4 def stringMapNested = “[‘foo’:’bar’, baz:[‘alpha’:’beta’]]” def map2 = evaluate(stringMapNested) assert map2.foo == “bar” assert map2.baz.alpha == “beta”