示例#1
0
 public void remove(DominoDocument doc, String fieldName, int idx) throws Exception {
   String json = doc.getItemValueString(fieldName);
   if (!StringUtil.isSpace(json)) {
     List<Object> array = (List<Object>) JsonParser.fromJson(JsonJavaFactory.instance, json);
     if (idx < array.size()) {
       array.remove(idx);
       doc.replaceItemValue(fieldName, JsonGenerator.toJson(JsonJavaFactory.instance, array));
     }
   }
 }
示例#2
0
 private String prettifyJSON(String source, boolean compact) throws Exception {
   Object o = JsonParser.fromJson(JsonJavaFactory.instance, new StringReader(source));
   return JsonGenerator.toJson(JsonJavaFactory.instance, o, compact);
 }
示例#3
0
 /**
  * Create a customer organization with a contact person.
  *
  * @param customerJson
  * @return
  * @throws BssException
  * @throws JsonException
  * @throws IOException
  */
 public JsonJavaObject registerCustomer(String customerJson)
     throws BssException, JsonException, IOException {
   JsonJavaObject jsonObject =
       (JsonJavaObject) JsonParser.fromJson(JsonJavaFactory.instanceEx, customerJson);
   return registerCustomer(jsonObject);
 }