更新时间:2022-04-13 05:27:34
由于您使用Groovy标记了问题,其本机JsonBuilder
似乎可以正常工作:
Since you tagged the question with Groovy, its native JsonBuilder
seems to work as expected:
import groovy.json.*
a = new JsonBuilder(mything: "[1, 2, 3]")
assert a.toString() == '{"mything":"[1, 2, 3]"}'
b = new JsonBuilder(params: a.getContent())
assert b.toString() == '{"params":{"mything":"[1, 2, 3]"}}'