List of utility methods to do Json
Double | toDouble(Object input) to Double return ((JsonNumber) input).doubleValue();
|
JsonArray | toJsonArrayString(Iterator to Json Array String JsonArrayBuilder builder = Json.createArrayBuilder(); while (items.hasNext()) { builder.add(items.next()); return builder.build(); |
JsonObject | union(JsonObject... values) Merges (unions) a list of Json objects into one object. JsonObjectBuilder builder = Json.createObjectBuilder(); for (JsonObject v : values) { for (Map.Entry<String, JsonValue> e : v.entrySet()) { builder.add(e.getKey(), e.getValue()); return builder.build(); |
void | writeMandatoryDateField(JsonGenerator generator, String fieldName, Date value) write Mandatory Date Field String formattedValue = formatDate(value); writeMandatoryStringField(generator, fieldName, formattedValue); |
void | writeReferenceValue(JsonGenerator generator, Integer value) Write a reference value (integer or null) into a JsonArray. if (value == null) { generator.write(JsonValue.NULL); } else { generator.write(value); |