java拼接json字符串

转义字符 \"表示 "

String json1 = "{\"serviceCode\":" + "\"" + text11 + "\"" + ", \"appId\":" + "\"" + text12 + "\"" + ",\"appSecret\":" + "\"" + text13 + "\"" + ",\"params\":[{\"sceneAreaId\":" + "\"" + text9 + "\"" + ",\"regulationValue\":" + "\"" + text10 + "\"" + "}]}";


在postman中美化后:
{
    "serviceCode""1",
    "appId""1",
    "appSecret""1",
    "params": [
        {
            "sceneAreaId""1",
            "regulationValue""111"
        }
    ]
}


posted @ 2022-03-23 17:03  sensen~||^_^|||&  阅读(1885)  评论(0)    收藏  举报