これを解決するために必要な情報を提供してくれた @fge に感謝します。
この問題を解決するために私がしたことは次のとおりです。
JsonNodeFactory nodeFactory = new JsonNodeFactory();
ObjectNode pushContent = nodeFactory.objectNode();
ObjectNode notification = nodeFactory.objectNode();
ObjectNode appsObj = nodeFactory.objectNode();
ObjectNode target = nodeFactory.objectNode();
ArrayNode apps = nodeFactory.arrayNode();
ArrayNode platforms = nodeFactory.arrayNode();
platforms.add("ios");
appsObj.put("id","app_id");
appsObj.put("platforms",platforms);
apps.add(appsObj);
notification.put("message",filledForm.field("text").value());
notification.put("sound","sounds/alarmsound.wav");
notification.put("target", target);
target.put("apps",apps);
pushContent.put("notification", notification);
pushContent.put("access_token","access_token");
if(!filledForm.field("usage").value().isEmpty()) {
target.put("usage",filledForm.field("usage").value());
}
if(!filledForm.field("latitude").value().isEmpty() && !filledForm.field("longitude").value().isEmpty() && !filledForm.field("radius").value().isEmpty()) {
target.put("latitude",filledForm.field("latitude").value());
target.put("longitude",filledForm.field("longitude").value());
target.put("radius",filledForm.field("radius").value());
}
pushContent を印刷すると、作成に必要な正確な json オブジェクトが出力されます。
これが他の誰かにも役立つことを願っています!
リッチ