Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如您所知,我们可以使用 toString() 方法简单地从哈希中获取字符串。所以我们得到类似这样的字符串:
[first:[one:1.1], second:2]
问题是,我们如何将这个字符串再次转换为散列?
您可以使用Eval.me 静态方法:
Eval.me
def map = Eval.me( '[first:[one:1.1], second:2]' ) assert map == [first:[one:1.1], second:2]