拼装json字符串

Posted Warren技术宅

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了拼装json字符串相关的知识,希望对你有一定的参考价值。

拼装json字符串:


       StringBuffer json = new StringBuffer();

        json.append("");
        json.append("[");
        
        json.append("userId:'111',");
        json.append("imageName:'222',");
        json.append("imagePaht:'333'");
       
        json.append("]");
        json.append("");

        System.out.println(json.toString());


结果:[userId:'111',imageName:'222',imagePaht:'333']

以上是关于拼装json字符串的主要内容,如果未能解决你的问题,请参考以下文章

json 拼装空listobject

Gson应用:利用map和list来拼装Json消息

Json对象应用

cxf 开发的 WebService,Web项目怎样才能使用 JSON格式访问,并返回JSON格式数据。

Golang 字符串拼装方式性能对比

JSONObject使用方法详解