Code example for JSONStringer

Methods: endObjectkeyobjecttoString

0
		String displayName = request.getContent().getString(req_displayName);
		String mobilePhone = request.getContent().getString(req_mobilePhone);
 
		String contactId = Telephony._flashInsertContact(cr, displayName,
				mobilePhone);
		JSONStringer js = new JSONStringer();
		js.object();
		js.key(resp_contactId).value(contactId);
		js.endObject();
		return Message.getResponseMessage(request.getRegion(), request
				.getCommand(), true, new JSONObject(js.toString()));
	} 
 
	// wu0wu 
	public Message getContactsByPhoneNumber(Message request)
			throws JSONException { 
		String req_phoneNumber = "phoneNumber";
		String resp_contactsByPhoneNumber = "contactsByPhoneNumber";
		String phoneNumber = request.getContent().getString(req_phoneNumber);
 
Experience pair programming with AI  Get Codota for Java