企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# 组件源码 /** * <b>方法描述:</b> 对象转string <br/> * <b>创建者:</b> admin <br/> * <b>创建时间:</b> 2019-11-22 10:22:27 <br/> * * @param obj 入参|对象|{@link Object} * @param value 出参|转换值|{@link java.lang.String} * @return 0 失败<br/> * 1 成功<br/> */ @Component(label = "对象转string", style = "判断型", type = "同步组件", comment = "将java对象转string", version = "1.0.0", deprecated = false, author = "admin", date = "2019-11-22 10:22:27") @InParams(param = {@Param(name = "obj", comment = "对象", type = Object.class)}) @OutParams(param = {@Param(name = "value", comment = "转换值", type = java.lang.String.class)}) @Returns(returns = {@Return(id = "0", desp = "失败"), @Return(id = "1", desp = "成功")}) public static ResultBase P_toString(Object obj) { String value=""; try { if(obj instanceof Collection) value= JSONArray.toJSONString(obj); else value=JSONObject.toJSONString(obj); } catch (Exception e) { AppLog.error("java对象转 json对象错误:",e); return ResultBase.newFailureResult("TPTK0002", "对象转json错误:" + AppLog.errorMsg(e)); } return ResultBase.newSuccessResult(value); } 交易中组件使用方式: ![](https://img.kancloud.cn/57/86/5786e1039ef71b8488b0063549fede61_1721x1282.png)