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.
hrere 是该问题的一个示例:
命令:
(new JSONObject([a:[b:1]])).toString()
将导致:
{"a":"{b=1}"}
当我期待得到
{"a":{"b":1}}
我错过了什么?
如果您在控制器中执行此操作,则可以使用 grails JSON 转换器进行转换:
import grails.converters.JSON ... render [a:[b:1]] as JSON