Code example for JsonObject

Methods: toStringaddaddProperty

0
		} 
		 
		String query = getParameterWithThrow("q", params, json);
		query = UtilsFunction.removeViSign(query);
 
		JsonObject jsonReturn = new JsonObject();
		ServiceResult<List<Page>> result = db.searchPageLike(query);
		if (result.isOK()) {
			jsonReturn.addProperty("errCode", 0);
			jsonReturn.addProperty("message", result.getMessage());
			 
			jsonReturn.add("pages", Global.gsonWithDate.toJsonTree(result.getResult()));
		} else { 
			jsonReturn.addProperty("errCode", 1);
			jsonReturn.addProperty("message", result.getMessage());
		} 
		return jsonReturn.toString();
	} 
 
}