编程技巧系列(6)如何使用MessageFormat格式化json串

来源:互联网 发布:上瘾网络剧在线看 编辑:程序博客网 时间:2024/06/08 04:53

API: http://tool.oschina.net/uploads/apidocs/jdk-zh/java/text/MessageFormat.html


使用单引号‘ 来实现左右大括号{}的无效设置

例如

String result = "'{\"info\":\"{0}\",\"status\":\"y\"}'";System.out.println(MessageFormat.format(result, new Object[]{"zone"}));


0 0