java提供link

java提供link,第1张

java提供link
JSONObject jsonObject = new JSONObject();
                    jsonObject.put("type", 1);
                    resp.setlink(new link(5, surveyId, "COLLECT_PAGE", jsonObject.toJSONString()));
public link(Integer type, String id, String url, String params) {
        this.type = type;
        this.id = id;
        this.url = url;
        this.isClear = isClear;
        this.params = params;
    }

处理这种请求link的

 "link":{
        "id":null,
        "isClear":false,
        "params":"{"type":1}",
        "type":5,
        "url":"COLLECT_PAGE"
    }

所以前端这种json格式,Java处理可以
JSonObject 对象用来解决

"{"type":1}"
JSONObject jsonObject = new JSONObject();
                    jsonObject.put("type", 1);

还有这样可以去接受前端传来json 但只给了你String

List categoryList = JSONObject.parseArray(categoryInfo, KeyValueData.class);
                

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5678369.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-17
下一篇 2022-12-17

发表评论

登录后才能评论

评论列表(0条)

保存