美文网首页
groovy jsonOutput将中文转为Unicode的问题

groovy jsonOutput将中文转为Unicode的问题

作者: 一飞冲不了天 | 来源:发表于2019-11-28 19:08 被阅读0次

使用StringEscapeUtils将Unicode转回中文即可

import groovy.json.JsonOutput
import groovy.json.StringEscapeUtils
#将Unicode转为中文
def str= StringEscapeUtils.unescapeJava(JsonOutput.toJson(jsonParams))
#将中文转为Unicode
#StringEscapeUtils.escapeJava(str)

相关文章

网友评论

      本文标题:groovy jsonOutput将中文转为Unicode的问题

      本文链接:https://www.haomeiwen.com/subject/lmqiwctx.html