Code examples for JSONObject

Codota analyzed 7,668,838 open source code samples to find the most common, credible and clear examples.
You can now enable Codota on your own code to easily search and navigate your Java codebase.
271:	JSONObject json = new JSONObject(response); 
-
275:	if (json.has("error")) { 
-
280:	if (json.has("error_code") && json.has("error_msg")) { 
281:	throw new FacebookError(json.getString("error_msg"), "", 
282:	Integer.parseInt(json.getString("error_code"))); 
-
284:	if (json.has("error_code")) { 
-
286:	Integer.parseInt(json.getString("error_code"))); 
-
288:	if (json.has("error_msg")) { 
289:	throw new FacebookError(json.getString("error_msg")); 
Full Snippet Info
9
CodeRank
157:	if (root.has(fieldName)) { 
158:	newArrayStep = root.getJSONArray(fieldName); 
-
161:	root.put(fieldName, newArrayStep); 
-
168:	if (root.has(steps[currentStep])) { 
169:	newStep = root.getJSONObject(steps[currentStep]); 
-
172:	root.put(steps[currentStep], newStep); 
Full Snippet Info
9
CodeRank
90:	JSONObject o = new JSONObject(); 
91:	o.put("code", "error"); 
92:	o.put("message", e.getMessage()); 
-
100:	o.put("stack", sw.toString()); 
Full Snippet Info
8
CodeRank
273:	JSONObject json = new JSONObject(response); 
-
277:	if (json.has("error")) { 
-
282:	if (json.has("error_code") && json.has("error_msg")) { 
283:	throw new FacebookError(json.getString("error_msg"), "", 
284:	Integer.parseInt(json.getString("error_code"))); 
-
286:	if (json.has("error_code")) { 
-
288:	Integer.parseInt(json.getString("error_code"))); 
-
290:	if (json.has("error_msg")) { 
291:	throw new FacebookError(json.getString("error_msg")); 
-
293:	if (json.has("error_reason")) { 
294:	throw new FacebookError(json.getString("error_reason")); 
Full Snippet Info
8
CodeRank
19:	model.setId(obj.optString("id")); 
20:	model.setThumbUrl(obj.getString("thumb")); 
21:	String url = obj.getString("large"); 
-
26:	url = obj.getString("url"); 
Full Snippet Info
8
CodeRank
92:	int top = obj.has("top") && !obj.isNull("top") ? obj.getInt("top") : 10; 
Full Snippet Info
8
CodeRank
158:	info.label = mObject.getString("label"); 
159:	info.callback = mObject.getString("action"); 
160:	if (mObject.has("icon")) { 
-
170:	info.disabled = mObject.getBoolean("disabled"); 
Full Snippet Info
8
CodeRank
20:	JSONObject object = new JSONObject(json); 
21:	mThumbnailUrl = object.getString("thumbnail_url"); 
22:	mUrl = object.getString("url"); 
23:	if (object.has("embeddable_url")) { 
24:	mExpandedUrl = object.getString("embeddable_url"); 
Full Snippet Info
8
CodeRank
266:	JSONObject json = new JSONObject(response); 
-
270:	if (json.has("error")) { 
-
275:	if (json.has("error_code") && json.has("error_msg")) { 
276:	throw new FacebookError(json.getString("error_msg"), "", 
277:	Integer.parseInt(json.getString("error_code"))); 
-
279:	if (json.has("error_code")) { 
-
281:	Integer.parseInt(json.getString("error_code"))); 
-
283:	if (json.has("error_msg")) { 
284:	throw new FacebookError(json.getString("error_msg")); 
-
286:	if (json.has("error_reason")) { 
287:	throw new FacebookError(json.getString("error_reason")); 
Full Snippet Info
8
CodeRank
283:	JSONObject obj = new JSONObject(); 
-
285:	obj.put("magneticHeading", this.getHeading()); 
286:	obj.put("trueHeading", this.getHeading()); 
-
289:	obj.put("headingAccuracy", 0); 
290:	obj.put("timestamp", this.timeStamp); 
Full Snippet Info
8
CodeRank
256:	JSONObject json = new JSONObject(response); 
-
260:	if (json.has("error")) { 
-
264:	if (json.has("error_code") && json.has("error_msg")) { 
265:	throw new FacebookError(json.getString("error_msg"), "", Integer.parseInt(json.getString("error_code"))); 
-
267:	if (json.has("error_code")) { 
268:	throw new FacebookError("request failed", "", Integer.parseInt(json.getString("error_code"))); 
-
270:	if (json.has("error_msg")) { 
271:	throw new FacebookError(json.getString("error_msg")); 
-
273:	if (json.has("error_reason")) { 
274:	throw new FacebookError(json.getString("error_reason")); 
Full Snippet Info
8
CodeRank
60:	JSONObject options = new JSONObject(); 
Full Snippet Info
8
CodeRank
308:	JSONObject o = new JSONObject(); 
309:	o.put("sling:resourceType", "sakai/learningCapability"); 
310:	o.put("sakai:pov", pointOfView); 
311:	o.put("sakai:id", keyValue.trim() + "_" + column); 
312:	o.put("sakai:name", COLUMNS[column]); 
313:	o.put("sakai:capability", value.trim()); 
-
315:	fw.append(o.toString(4)); 
Full Snippet Info
8
CodeRank
297:	JSONObject json = new JSONObject(jsonString); 
-
299:	String valueType = json.getString(JSON_VALUE_TYPE); 
-
365:	String charString = json.getString(JSON_VALUE); 
-
380:	bundle.putString(key, json.getString(JSON_VALUE)); 
-
392:	String enumType = json.getString(JSON_VALUE_ENUM_TYPE); 
-
396:	Enum<?> enumValue = Enum.valueOf(enumClass, json.getString(JSON_VALUE)); 
Full Snippet Info
8
CodeRank
253:	JSONObject json = new JSONObject(response); 
-
257:	if (json.has("error")) { 
-
262:	if (json.has("error_code") && json.has("error_msg")) { 
263:	throw new TwitterError(json.getString("error_msg"), "", 
-
266:	if (json.has("error_code")) { 
-
270:	if (json.has("error_msg")) { 
271:	throw new TwitterError(json.getString("error_msg")); 
Full Snippet Info
8
CodeRank
274:	JSONObject r = new JSONObject(); 
-
276:	r.put("x", this.x); 
277:	r.put("y", this.y); 
Full Snippet Info
8
CodeRank
101:	JSONObject json = new JSONObject(responseBody); 
102:	if (!json.has("sessionId") || json.isNull("sessionId")) { 
-
105:	return new ExternalSessionKey(json.getString("sessionId")); 
Full Snippet Info
8
CodeRank
260:	JSONObject json = new JSONObject(response); 
-
264:	if (json.has("error")) { 
-
269:	if (json.has("error_code") && json.has("error_msg")) { 
-
273:	if (json.has("error_code")) { 
-
277:	if (json.has("error_msg")) { 
-
280:	if (json.has("error_reason")) { 
281:	throw new FacebookError(json.getString("error_reason")); 
Full Snippet Info
8
CodeRank
22:	JSONObject jsonObj = new JSONObject(jsonMessage); 
23:	JSONObject data = jsonObj.getJSONObject("data"); 
-
25:	this.type = data.getString("type"); 
26:	this.body = data.getString("body"); 
Full Snippet Info
-10
CodeRank