本文整理了Java中com.alibaba.fastjson.JSONObject.remove()
方法的一些代码示例,展示了JSONObject.remove()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSONObject.remove()
方法的具体详情如下:
包路径:com.alibaba.fastjson.JSONObject
类名称:JSONObject
方法名:remove
暂无
代码示例来源:origin: ltsopensource/light-task-scheduler
@Override
public Object remove(String key) {
return jsonObject.remove(key);
}
代码示例来源:origin: ltsopensource/light-task-scheduler
@Override
public Object remove(String key) {
return jsonObject.remove(key);
}
代码示例来源:origin: TommyLemon/APIJSON
throw new IllegalArgumentException("格式错误!找不到 " + k + ":" + value + " 对应[" + v + "]内的任何一项!");
request.put(rk, request.remove(k));
corrected.put(k, rk);
代码示例来源:origin: TommyLemon/APIJSON
requestObject.remove(JSONRequest.KEY_TAG);
requestObject.remove(JSONRequest.KEY_VERSION);
return parseCorrectRequest((JSONObject) target.clone());
代码示例来源:origin: TommyLemon/APIJSON
request.remove(KEY_ID);
request.remove(KEY_ID_IN);
request.remove(KEY_ROLE);
request.remove(KEY_DATABASE);
request.remove(KEY_SCHEMA);
request.remove(KEY_COMBINE);
request.remove(KEY_FROM);
request.remove(KEY_COLUMN);
request.remove(KEY_GROUP);
request.remove(KEY_HAVING);
request.remove(KEY_ORDER);
代码示例来源:origin: TommyLemon/APIJSON
tableObj.put(key, tableObj.remove(key)); //保证和SQLExcecutor缓存的Config里where顺序一致,生成的SQL也就一致
代码示例来源:origin: TommyLemon/APIJSON
target.remove(TYPE.name());
target.remove(VERIFY.name());
target.remove(INSERT.name());
target.remove(ADD.name());
target.remove(UPDATE.name());
target.remove(PUT.name());
target.remove(REPLACE.name());
target.remove(UNIQUE.name());
target.remove(REMOVE.name());
target.remove(NECESSARY.name());
target.remove(DISALLOW.name());
if (removes != null && removes.length > 0) {
for (String r : removes) {
real.remove(r);
real.remove(rk);
continue;
代码示例来源:origin: TommyLemon/APIJSON
((JSONObject) value).remove(JSONRequest.KEY_COUNT);
((JSONObject) value).remove(JSONRequest.KEY_PAGE);
代码示例来源:origin: TommyLemon/APIJSON
this.correct = request.getJSONObject(KEY_CORRECT);
request.remove(KEY_TRY);
request.remove(KEY_DROP);
request.remove(KEY_CORRECT);
代码示例来源:origin: TommyLemon/APIJSON
try {
setGlobleRole(RequestRole.get(requestObject.getString(JSONRequest.KEY_ROLE)));
requestObject.remove(JSONRequest.KEY_ROLE);
} catch (Exception e) {
return extendErrorResult(requestObject, e);
setGlobleFormat(requestObject.getBooleanValue(JSONRequest.KEY_FORMAT));
requestObject.remove(JSONRequest.KEY_DATABASE);
requestObject.remove(JSONRequest.KEY_FORMAT);
} catch (Exception e) {
return extendErrorResult(requestObject, e);
代码示例来源:origin: TommyLemon/APIJSON
request.remove(JSONRequest.KEY_QUERY);
request.remove(JSONRequest.KEY_COUNT);
request.remove(JSONRequest.KEY_PAGE);
request.remove(JSONRequest.KEY_JOIN);
Log.d(TAG, "getArray query = " + query + "; count = " + count + "; page = " + page + "; join = " + join);
代码示例来源:origin: foxinmy/weixin4j
@Override
public void processExtra(Object object, String key, Object value) {
if (KEY.equalsIgnoreCase(key)) {
JSONArray news = ((JSONObject) value).getJSONArray("list");
List<MpArticle> newsList = new ArrayList<MpArticle>(news.size());
JSONObject article = null;
for (int i = 0; i < news.size(); i++) {
article = news.getJSONObject(i);
article.put("show_cover_pic", article.remove("show_cover"));
article.put("thumb_url", article.remove("cover_url"));
article.put("url", article.remove("content_url"));
article.put("content_source_url", article.remove("source_url"));
newsList.add(JSON.toJavaObject(article, MpArticle.class));
}
((Button) object).setExtra(newsList);
} else {
((Button) object).setContent(String.valueOf(value));
}
}
};
代码示例来源:origin: foxinmy/weixin4j
private ApiResult excute(String uri, User user, InputStream avatar)
throws WeixinException {
JSONObject obj = (JSONObject) JSON.toJSON(user);
Object val = obj.remove("extattr");
if (val != null) {
JSONObject attrs = new JSONObject();
attrs.put("attrs", val);
obj.put("extattr", attrs);
}
val = obj.remove("status");
if (val != null) {
obj.put("enable", val);
}
if (avatar != null) {
obj.put("avatar_mediaid", mediaApi.uploadMedia(0, avatar, null));
} else {
obj.put("avatar_mediaid", obj.remove("avatar"));
}
Token token = tokenManager.getCache();
WeixinResponse response = weixinExecutor.post(
String.format(uri, token.getAccessToken()), obj.toJSONString());
return response.getAsResult();
}
代码示例来源:origin: foxinmy/weixin4j
/**
* 获取企业号的授权信息
*
* @param authCorpId
* 授权方corpid
* @return 授权方信息
* @throws WeixinException
* @see com.foxinmy.weixin4j.qy.model.OUserInfo
* @see <a href=
* "https://work.weixin.qq.com/api/doc#10975/获取企业授权信息">获取企业号的授权信息</a>
*/
public OUserInfo getAuthInfo(String authCorpId) throws WeixinException {
String suite_get_authinfo_uri = getRequestUri("suite_get_authinfo_uri");
JSONObject obj = new JSONObject();
obj.put("suite_id", ticketManager.getThirdId());
obj.put("auth_corpid", authCorpId);
obj.put("permanent_code", getPerTicketManager(authCorpId)
.getAccessTicket());
WeixinResponse response = weixinExecutor.post(
String.format(suite_get_authinfo_uri,
tokenManager.getAccessToken()), obj.toJSONString());
obj = response.getAsJson();
obj.put("corp_info", obj.remove("auth_corp_info"));
obj.put("user_info", obj.remove("auth_user_info"));
return JSON.toJavaObject(obj, OUserInfo.class);
}
代码示例来源:origin: foxinmy/weixin4j
/**
* 企业付款为企业提供付款至用户零钱的能力
*
* @param payment 付款信息
* @return 付款结果
* @see com.foxinmy.weixin4j.payment.mch.CorpPayment
* @see com.foxinmy.weixin4j.payment.mch.CorpPaymentResult
* @see <a href="https://pay.weixin.qq.com/wiki/doc/api/tools/mch_pay.php?chapter=14_2">企业付款</a>
* @see <a href="https://pay.weixin.qq.com/wiki/doc/api/tools/mch_pay.php?chapter=14_1">场景介绍(使用条件、付款资金、付款规则等)</a>
* @throws WeixinException
*/
public CorpPaymentResult sendCorpPayment(CorpPayment payment)
throws WeixinException {
super.declareMerchant(payment);
JSONObject obj = (JSONObject) JSON.toJSON(payment);
obj.put("mchid", obj.remove("mch_id"));
obj.put("mch_appid", obj.remove("appid"));
obj.put("sign", weixinSignature.sign(obj));
String param = XmlStream.map2xml(obj);
WeixinResponse response = getWeixinSSLExecutor().post(
getRequestUri("corppayment_send_uri"), param);
String text = response.getAsString()
.replaceFirst("<mch_appid>", "<appid>")
.replaceFirst("</mch_appid>", "</appid>")
.replaceFirst("<mchid>", "<mch_id>")
.replaceFirst("</mchid>", "</mch_id>");
return XmlStream.fromXML(text, CorpPaymentResult.class);
}
代码示例来源:origin: foxinmy/weixin4j
throws WeixinException {
JSONObject obj = (JSONObject) JSON.toJSON(chatInfo);
obj.remove("userlist");
obj.put("op_user", operator);
obj.put("add_user_list", addUsers);
代码示例来源:origin: foxinmy/weixin4j
/**
* 创建部门(根部门的parentid为1)
*
* @param party
* 部门对象
* @see com.foxinmy.weixin4j.qy.model.Party
* @see <a href="https://work.weixin.qq.com/api/doc#10076">创建部门说明</a>
* @return 部门ID
* @throws WeixinException
*/
public int createParty(Party party) throws WeixinException {
String department_create_uri = getRequestUri("department_create_uri");
JSONObject obj = (JSONObject) JSON.toJSON(party);
if (party.getParentId() < 1) {
obj.remove("parentid");
}
if (party.getId() < 1) {
obj.remove("id");
}
Token token = tokenManager.getCache();
WeixinResponse response = weixinExecutor.post(
String.format(department_create_uri, token.getAccessToken()),
obj.toJSONString());
return response.getAsJson().getIntValue("id");
}
代码示例来源:origin: foxinmy/weixin4j
/**
* 获取成员
*
* @param userid
* 成员唯一ID
* @see com.foxinmy.weixin4j.qy.model.User
* @see <a href= "http://work.weixin.qq.com/api/doc#10019">获取成员说明</a>
* @return 成员对象
* @throws WeixinException
*/
public User getUser(String userid) throws WeixinException {
String user_get_uri = getRequestUri("user_get_uri");
Token token = tokenManager.getCache();
WeixinResponse response = weixinExecutor.get(String.format(
user_get_uri, token.getAccessToken(), userid));
JSONObject obj = response.getAsJson();
Object attrs = obj.remove("extattr");
User user = JSON.toJavaObject(obj, User.class);
if (attrs != null) {
user.setExtattr(JSON.parseArray(
((JSONObject) attrs).getString("attrs"), NameValue.class));
}
return user;
}
代码示例来源:origin: foxinmy/weixin4j
/**
* 更新部门(如果非必须的字段未指定 则不更新该字段之前的设置值)
*
* @param party
* 部门对象
* @see com.foxinmy.weixin4j.qy.model.Party
* @see <a href="https://work.weixin.qq.com/api/doc#10077">更新部门说明</a>
* @return 处理结果
* @throws WeixinException
*/
public ApiResult updateParty(Party party) throws WeixinException {
if (party.getId() < 1) {
throw new WeixinException("department id must gt 1");
}
String department_update_uri = getRequestUri("department_update_uri");
JSONObject obj = (JSONObject) JSON.toJSON(party);
if (party.getParentId() < 1) {
obj.remove("parentid");
}
if (party.getOrder() < 0) {
obj.remove("order");
}
Token token = tokenManager.getCache();
WeixinResponse response = weixinExecutor.post(
String.format(department_update_uri, token.getAccessToken()),
obj.toJSONString());
return response.getAsResult();
}
代码示例来源:origin: foxinmy/weixin4j
/**
* 创建标签(创建的标签属于管理组;默认为加锁状态。加锁状态下只有本管理组才可以增删成员,解锁状态下其它管理组也可以增删成员)
*
* @param tag
* 标签对象;</br> 标签名称,长度限制为32个字(汉字或英文字母),标签名不可与其他标签重名。</br> 标签id,整型,
* 指定此参数时新增的标签会生成对应的标签id,不指定时则以目前最大的id自增。
* @see <a href= "https://work.weixin.qq.com/api/doc#10915"> 创建标签说明</a>
* @return 标签ID
* @throws WeixinException
*/
public int createTag(Tag tag) throws WeixinException {
String tag_create_uri = getRequestUri("tag_create_uri");
Token token = tokenManager.getCache();
JSONObject obj = (JSONObject) JSON.toJSON(tag);
if (obj.getIntValue("tagid") <= 0) {
obj.remove("tagid");
}
WeixinResponse response = weixinExecutor.post(
String.format(tag_create_uri, token.getAccessToken()),
obj.toJSONString());
return response.getAsJson().getIntValue("tagid");
}
内容来源于网络,如有侵权,请联系作者删除!