Code example for JsonObject

Methods: toStringaddaddProperty

0
		} catch (Exception e) {
		} 
		 
		String query = getParameter("q", params, json);
 
		JsonObject jsonReturn = new JsonObject();
 
		ServiceResult<List<UserInfo>> result = db.searchUsernamesLike(query);
		if (result.isOK()) {
			jsonReturn.addProperty("errCode", 0);
			jsonReturn.addProperty("message", result.getMessage());
			 
			jsonReturn.add("userinfos", Global.gsonDateWithoutHour.toJsonTree(result.getResult()));
		} else { 
			jsonReturn.addProperty("errCode", 1);
			jsonReturn.addProperty("message", result.getMessage());
		} 
		return jsonReturn.toString();
	} 
 
} 
Experience pair programming with AI  Get Codota for Java