Пример #1
0
  @Test
  public void testJsonArrayToClone() {
    JsonArray array = new JsonArray();
    array.add("test");
    JsonObject object = new JsonObject();
    object.putArray("array", array);

    // want to clone
    JsonObject object2 = new JsonObject(object.toMap());
    // this shouldn't throw an exception, it does before patch
    JsonArray array2 = object2.getArray("array");
  }
Пример #2
0
 @Override
 public void handle(Message<JsonArray> event) {
   JsonArray filteredArray = new JsonArray();
   Context context = Context.enter();
   for (Object obj : event.body()) {
     JsonObject jsonObject = (JsonObject) obj;
     Map filtered = filter.filter(jsonObject.toMap());
     if (filtered != null) {
       filteredArray.add(new JsonObject(filtered));
     }
   }
   event.reply(filteredArray);
 }