Code example for JsonArray

Methods: add

0
	} 
 
	private JsonObject toJson(final User user) {
		final JsonObject rowObj = new JsonObject();
		rowObj.addProperty("id", user.getId());
		final JsonArray cells = new JsonArray();
		cells.add(new JsonPrimitive(user.getId()));
		cells.add(new JsonPrimitive(user.getFirstName()));
		cells.add(new JsonPrimitive(user.getLastName()));
		cells.add(new JsonPrimitive(user.getEmail()));
		cells.add(new JsonPrimitive(user.getId()));
		rowObj.add("cell", cells);
		return rowObj;
	} 
	 
} 
Experience pair programming with AI  Get Codota for Java