org.json.JSONObject.accumulate()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(210)

本文整理了Java中org.json.JSONObject.accumulate()方法的一些代码示例,展示了JSONObject.accumulate()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSONObject.accumulate()方法的具体详情如下:
包路径:org.json.JSONObject
类名称:JSONObject
方法名:accumulate

JSONObject.accumulate介绍

[英]Appends value to the array already mapped to name. If this object has no mapping for name, this inserts a new mapping. If the mapping exists but its value is not an array, the existing and new values are inserted in order into a new array which is itself mapped to name. In aggregate, this allows values to be added to a mapping one at a time.
[中]将值追加到已映射到名称的数组。如果此对象没有名称映射,则会插入新映射。如果映射存在,但其值不是数组,则将现有值和新值依次插入到新数组中,该数组本身映射到名称。总的来说,这允许每次向映射添加一个值。

代码示例

代码示例来源:origin: apache/hive

jsonDep.put("parent", dep.getName());
jsonDep.put("type", dep.getType());
json.accumulate(ent.getKey().toString(), jsonDep);
jsonDep.put("type", dep.getShuffleType());
jsonDep.put("partitions", dep.getNumPartitions());
json.accumulate(ent.getKey().toString(), jsonDep);

代码示例来源:origin: apache/drill

jsonDep.put("parent", dep.getName());
jsonDep.put("type", dep.getType());
json.accumulate(ent.getKey().toString(), jsonDep);
jsonDep.put("type", dep.getShuffleType());
jsonDep.put("partitions", dep.getNumPartitions());
json.accumulate(ent.getKey().toString(), jsonDep);

代码示例来源:origin: loklak/loklak_server

string = x.nextCDATA();
  if (string.length() > 0) {
    context.accumulate("content", string);
    throw x.syntaxError("Missing value");
  jsonobject.accumulate(string,
      keepStrings ? ((String)token) : stringToValue((String) token));
  token = null;
} else {
  jsonobject.accumulate(string, "");
  context.accumulate(tagName, jsonobject);
} else {
  context.accumulate(tagName, "");
    string = (String) token;
    if (string.length() > 0) {
      jsonobject.accumulate("content",
          keepStrings ? string : stringToValue(string));
        context.accumulate(tagName, "");
      } else if (jsonobject.length() == 1
          && jsonobject.opt("content") != null) {
        context.accumulate(tagName,
            jsonobject.opt("content"));
      } else {
        context.accumulate(tagName, jsonobject);

代码示例来源:origin: apache/drill

JSONObject jsonOut = outputPlan(op, out, extended, jsonOutput, cindent);
if (jsonOutput) {
 ((JSONObject)json.get(JSONObject.getNames(json)[0])).accumulate("children", jsonOut);

代码示例来源:origin: apache/hive

JSONObject jsonOut = outputPlan(op, out, extended, jsonOutput, cindent, "", inTest);
if (jsonOutput) {
 ((JSONObject)json.get(JSONObject.getNames(json)[0])).accumulate("children", jsonOut);

代码示例来源:origin: loklak/loklak_server

throw x.syntaxError("Missing value");
  newjo.accumulate(attribute, keepStrings ? ((String)token) :XML.stringToValue((String)token));
  token = null;
} else {
  newjo.accumulate(attribute, "");

代码示例来源:origin: b3log/latke

string = x.nextCDATA();
  if (string.length() > 0) {
    context.accumulate("content", string);
    throw x.syntaxError("Missing value");
  jsonobject.accumulate(string,
      keepStrings ? ((String)token) : stringToValue((String) token));
  token = null;
} else {
  jsonobject.accumulate(string, "");
  context.accumulate(tagName, jsonobject);
} else {
  context.accumulate(tagName, "");
    string = (String) token;
    if (string.length() > 0) {
      jsonobject.accumulate("content",
          keepStrings ? string : stringToValue(string));
        context.accumulate(tagName, "");
      } else if (jsonobject.length() == 1
          && jsonobject.opt("content") != null) {
        context.accumulate(tagName,
            jsonobject.opt("content"));
      } else {
        context.accumulate(tagName, jsonobject);

代码示例来源:origin: b3log/latke

throw x.syntaxError("Missing value");
  newjo.accumulate(attribute, keepStrings ? ((String)token) :XML.stringToValue((String)token));
  token = null;
} else {
  newjo.accumulate(attribute, "");

代码示例来源:origin: Odoo-mobile/framework

public void addAll(String[] fields) {
  try {
    for (String field : fields) {
      jFields.accumulate("fields", field);
    }
    if (fields.length == 1) {
      jFields.accumulate("fields", fields[0]);
    }
  } catch (Exception e) {
    e.printStackTrace();
  }
}

代码示例来源:origin: stackoverflow.com

JSONObject channel_one = new JSONObject();
String link1 = "..";
String link2 = "..";
String link3 = "..";
String link4 = "..";

channel_one.put("links", link1);
channel_one.accumulate("links", link2);
channel_one.accumulate("links", link3);
channel_one.accumulate("links", link4);

代码示例来源:origin: stackoverflow.com

class JqGridModel{

  public JSONObject toJSON(){
    JSONObject json = new JSONObject();
    json.accumulate("OrderID", orderID);
    // DO the same for all attributes
    return  json;
  }
}

代码示例来源:origin: stackoverflow.com

JSONObject data= new JSONObject();
     data.accumulate("username", "mobileGps");
     data.accumulate("password", "9565551236");
     JSONObject total= new JSONObject();
     total.put("data",data);
     json = jsonObjectNew.toString();

代码示例来源:origin: com.sendgrid/smtpapi-java

public SMTPAPI addTo(String to) throws JSONException {
 if (!this.header.has("to")) {
     this.header.put("to", new JSONArray());
   }
   this.header.accumulate("to", to);
 return this;
}

代码示例来源:origin: danysantiago/sendgrid-android

public SMTPAPI addTo(String to) throws JSONException {
 if (!this.header.has("to")) {
  this.header.put("to", new JSONArray());
 }
 this.header.accumulate("to", to);
 return this;
}

代码示例来源:origin: braintree/braintree_android

private JSONObject getEventParams(Map<String, String> params) throws JSONException {
  JSONObject ret = new JSONObject();
  for (String key : params.keySet()) {
    ret.accumulate(key, params.get(key));
  }
  return ret;
}

代码示例来源:origin: com.sendgrid/smtpapi-java

public SMTPAPI addCategory(String val) throws JSONException {
 if (!this.header.has("category")) {
     this.header.put("category", new JSONArray());
   }
   this.header.accumulate("category", val);
 return this;
}

代码示例来源:origin: danysantiago/sendgrid-android

public SMTPAPI addCategory(String val) throws JSONException {
 if (!this.header.has("category")) {
  this.header.put("category", new JSONArray());
 }
 this.header.accumulate("category", val);
 return this;
}

代码示例来源:origin: stackoverflow.com

JSONObject json = new JSONObject();
json.put("email","email@domain.com");
json.put("password", "pass");

JSONObject json2 = new JSONObject();
json2.accumulate("data",json);

代码示例来源:origin: stackoverflow.com

JSONObject objFirst = new JSONObject();
     objFirst.put("description", "ADBCD");
     objFirst.put("type", "TEXT");
     JSONObject objSecond = new JSONObject();
     objSecond.put("askjdhasjk", "XYZ");
     objFirst.accumulate("This Nw", objSecond);

代码示例来源:origin: danysantiago/sendgrid-android

public SMTPAPI addSubstitution(String key, String val) throws JSONException {
 if (this.header.isNull("sub")) {
  this.header.put("sub", new JSONObject());
 }
 JSONObject subs = this.header.getJSONObject("sub");
 if (!subs.has(key)) {
  subs.put(key, new JSONArray());
 }
 subs.accumulate(key, val);
 return this;
}

相关文章

微信公众号

最新文章

更多

JSONObject类方法