List of usage examples for org.json JSONObject getJSONArray
public JSONArray getJSONArray(String key) throws JSONException
From source file:com.gvccracing.android.tttimer.Tabs.RaceInfoTab.java
public void postData() { // Create a new HttpClient and Post Header HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost( "http://www.gvccracing.com/?page_id=2525&pass=com.gvccracing.android.tttimer"); try {/*from w ww .ja va 2s. c o m*/ // Execute HTTP Post Request HttpResponse response = httpclient.execute(httppost); InputStream is = response.getEntity().getContent(); BufferedInputStream bis = new BufferedInputStream(is); ByteArrayBuffer baf = new ByteArrayBuffer(20); int current = 0; while ((current = bis.read()) != -1) { baf.append((byte) current); } /* Convert the Bytes read to a String. */ String text = new String(baf.toByteArray()); JSONObject mainJson = new JSONObject(text); JSONArray jsonArray = mainJson.getJSONArray("members"); for (int i = 0; i < jsonArray.length(); i++) { JSONObject json = jsonArray.getJSONObject(i); String firstName = json.getString("fname"); String lastName = json.getString("lname"); String licenseStr = json.getString("license"); Integer license = 0; try { license = Integer.parseInt(licenseStr); } catch (Exception ex) { Log.e(LOG_TAG(), "Unable to parse license string"); } long age = json.getLong("age"); String categoryStr = json.getString("category"); Integer category = 5; try { category = Integer.parseInt(categoryStr); } catch (Exception ex) { Log.e(LOG_TAG(), "Unable to parse category string"); } String phone = json.getString("phone"); long phoneNumber = 0; try { phoneNumber = Long.parseLong(phone.replace("-", "").replace("(", "").replace(")", "") .replace(" ", "").replace(".", "").replace("*", "")); } catch (Exception e) { Log.e(LOG_TAG(), "Unable to parse phone number"); } String gender = json.getString("gender"); String econtact = json.getString("econtact"); String econtactPhone = json.getString("econtact_phone"); long eContactPhoneNumber = 0; try { eContactPhoneNumber = Long.parseLong(econtactPhone.replace("-", "").replace("(", "") .replace(")", "").replace(" ", "").replace(".", "").replace("*", "")); } catch (Exception e) { Log.e(LOG_TAG(), "Unable to parse econtact phone number"); } Long member_id = json.getLong("member_id"); String gvccCategory; switch (category) { case 1: case 2: case 3: gvccCategory = "A"; break; case 4: gvccCategory = "B4"; break; case 5: gvccCategory = "B5"; break; default: gvccCategory = "B5"; break; } Log.w(LOG_TAG(), lastName); Cursor racerInfo = Racer.Instance().Read(getActivity(), new String[] { Racer._ID, Racer.FirstName, Racer.LastName, Racer.USACNumber, Racer.PhoneNumber, Racer.EmergencyContactName, Racer.EmergencyContactPhoneNumber }, Racer.USACNumber + "=?", new String[] { license.toString() }, null); if (racerInfo.getCount() > 0) { racerInfo.moveToFirst(); Long racerID = racerInfo.getLong(racerInfo.getColumnIndex(Racer._ID)); Racer.Instance().Update(getActivity(), racerID, firstName, lastName, license, 0l, phoneNumber, econtact, eContactPhoneNumber, gender); Cursor racerClubInfo = RacerClubInfo.Instance().Read(getActivity(), new String[] { RacerClubInfo._ID, RacerClubInfo.GVCCID, RacerClubInfo.RacerAge, RacerClubInfo.Category }, RacerClubInfo.Racer_ID + "=? AND " + RacerClubInfo.Year + "=? AND " + RacerClubInfo.Upgraded + "=?", new String[] { racerID.toString(), "2013", "0" }, null); if (racerClubInfo.getCount() > 0) { racerClubInfo.moveToFirst(); long racerClubInfoID = racerClubInfo .getLong(racerClubInfo.getColumnIndex(RacerClubInfo._ID)); String rciCategory = racerClubInfo .getString(racerClubInfo.getColumnIndex(RacerClubInfo.Category)); boolean upgraded = gvccCategory != rciCategory; if (upgraded) { RacerClubInfo.Instance().Update(getActivity(), racerClubInfoID, null, null, null, null, null, null, null, null, null, upgraded); RacerClubInfo.Instance().Create(getActivity(), racerID, null, 2013, gvccCategory, 0, 0, 0, age, member_id, false); } else { RacerClubInfo.Instance().Update(getActivity(), racerClubInfoID, null, null, null, null, null, null, null, age, member_id, upgraded); } } else { RacerClubInfo.Instance().Create(getActivity(), racerID, null, 2013, gvccCategory, 0, 0, 0, age, member_id, false); } if (racerClubInfo != null) { racerClubInfo.close(); } } else { // TODO: Better birth date Uri resultUri = Racer.Instance().Create(getActivity(), firstName, lastName, license, 0l, phoneNumber, econtact, eContactPhoneNumber, gender); long racerID = Long.parseLong(resultUri.getLastPathSegment()); RacerClubInfo.Instance().Create(getActivity(), racerID, null, 2013, gvccCategory, 0, 0, 0, age, member_id, false); } if (racerInfo != null) { racerInfo.close(); } } } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (JSONException e) { Log.e(LOG_TAG(), e.getMessage()); } }
From source file:com.namelessdev.mpdroid.cover.ItunesCover.java
@Override public String[] getCoverUrl(final AlbumInfo albumInfo) throws Exception { final String response; final JSONObject jsonRootObject; final JSONArray jsonArray; String coverUrl;// www . ja v a 2 s . c o m JSONObject jsonObject; try { response = executeGetRequest("https://itunes.apple.com/search?term=" + albumInfo.getAlbum() + ' ' + albumInfo.getArtist() + "&limit=5&media=music&entity=album"); jsonRootObject = new JSONObject(response); jsonArray = jsonRootObject.getJSONArray("results"); for (int i = 0; i < jsonArray.length(); i++) { jsonObject = jsonArray.getJSONObject(i); coverUrl = jsonObject.getString("artworkUrl100"); if (coverUrl != null) { // Based on some tests even if the cover art size returned // is 100x100 // Bigger versions also exists. return new String[] { coverUrl.replace("100x100", "600x600") }; } } } catch (final Exception e) { if (CoverManager.DEBUG) { Log.e(TAG, "Failed to get cover URL from " + getName(), e); } } return new String[0]; }
From source file:produvia.com.scanner.DevicesActivity.java
private void updateServiceDeviceDatabase(JSONObject data) { try {/*from www.ja v a 2s. c om*/ //first add the services to the devices: JSONArray services = data.getJSONArray("services"); for (int i = 0; i < services.length(); i++) { JSONObject service = services.getJSONObject(i); String device_id = service.getString("device_id"); JSONObject device = data.getJSONObject("devices_info").getJSONObject(device_id); if (!device.has("services")) device.put("services", new JSONObject()); device.getJSONObject("services").put(service.getString("id"), service); } JSONObject devices = data.getJSONObject("devices_info"); //loop over the devices and merge them into the device display: for (Iterator<String> iter = devices.keys(); iter.hasNext();) { String device_id = iter.next(); JSONObject device = devices.getJSONObject(device_id); //if a device card is already present - just merge the data: boolean found = false; int network_card_idx = -1; for (int i = 0; i < mDevices.size(); i++) { CustomListItem cli = mDevices.get(i); if (cli instanceof DeviceCard && ((DeviceCard) cli).getId().equals(device_id)) { ((DeviceCard) cli).updateInfo(device); found = true; break; } else if (cli.getDescription().equals(device.getString("network_id"))) { network_card_idx = i; } } if (!found) { if (network_card_idx < 0) { JSONObject network = data.getJSONObject("networks_info") .getJSONObject(device.getString("network_id")); String name = ""; if (network.has("name") && network.getString("name") != null) name = network.getString("name"); network_card_idx = addNetworkCard(name, device.getString("network_id"), network.getBoolean("user_inside_network")); } network_card_idx += 1; //find the correct index for the card sorted by last seen: for (; network_card_idx < mDevices.size(); network_card_idx++) { CustomListItem cli = mDevices.get(network_card_idx); if (!(cli instanceof DeviceCard)) break; if (((DeviceCard) cli).getLastSeen() .compareTo(DeviceCard.getLastSeenFromString(device.getString("last_seen"))) < 0) break; } DeviceCard dc = new DeviceCard(device); mDevices.add(network_card_idx, dc); } } notifyDataSetChanged(); } catch (JSONException e) { Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show(); } }
From source file:org.wso2.carbon.connector.integration.test.quickbooks.QuickbooksConnectorIntegrationTest.java
/** * Positive test case for createPurchase method with mandatory parameters. *//*from w w w. j a va2s. c o m*/ @Test(priority = 1, dependsOnMethods = { "testCreateAccountWithMandatoryParameters", "testCreateAccountWithOptionalParameters" }, description = "quickbooks {createPurchase} integration test with mandatory parameters.") public void tesCreatePurchaseWithMandatoryParameters() throws IOException, JSONException { esbRequestHeadersMap.put("Action", "urn:createPurchase"); RestResponse<JSONObject> esbRestResponse = sendJsonRestRequest(proxyUrl, "POST", esbRequestHeadersMap, "esb_createPurchase_mandatory.json"); JSONObject esbResponseObject = esbRestResponse.getBody().getJSONObject("Purchase"); String purchaseId = esbResponseObject.getString("Id"); String apiEndPoint = connectorProperties.getProperty("apiUrl") + "/v3/company/" + companyId + "/purchase/" + purchaseId; String OAuthHeader = getOAuthHeader("GET", apiEndPoint); apiRequestHeadersMap.put("Authorization", OAuthHeader); RestResponse<JSONObject> apiRestResponse = sendJsonRestRequest(apiEndPoint, "GET", apiRequestHeadersMap); JSONObject apiResponseObject = apiRestResponse.getBody().getJSONObject("Purchase"); JSONArray apiLineArray = apiResponseObject.getJSONArray("Line"); Assert.assertEquals(connectorProperties.getProperty("expenseAccountRef"), apiLineArray.getJSONObject(0) .getJSONObject("AccountBasedExpenseLineDetail").getJSONObject("AccountRef").getString("value")); Assert.assertEquals(connectorProperties.getProperty("bankAccoutId"), apiResponseObject.getJSONObject("AccountRef").getString("value")); Assert.assertEquals(esbResponseObject.getJSONObject("MetaData").getString("CreateTime"), apiResponseObject.getJSONObject("MetaData").getString("CreateTime")); }
From source file:org.wso2.carbon.connector.integration.test.quickbooks.QuickbooksConnectorIntegrationTest.java
/** * Positive test case for createPurchaseOrder method with mandatory parameters. *//* w w w .j a va 2 s.com*/ @Test(priority = 1, dependsOnMethods = { "tesCreateItemWithOptionalParameters", "testCreateVendorWithOptionalParameters" }, description = "quickbooks {createPurchaseOrder} integration test with mandatory parameters.") public void tesCreatePurchaseOrderWithMandatoryParameters() throws IOException, JSONException { esbRequestHeadersMap.put("Action", "urn:createPurchaseOrder"); RestResponse<JSONObject> esbRestResponse = sendJsonRestRequest(proxyUrl, "POST", esbRequestHeadersMap, "esb_createPurchaseOrder_mandatory.json"); JSONObject esbResponseObject = esbRestResponse.getBody().getJSONObject("PurchaseOrder"); String purchaseOrderId = esbResponseObject.getString("Id"); connectorProperties.setProperty("purchaseOrderId", purchaseOrderId); String apiEndPoint = connectorProperties.getProperty("apiUrl") + "/v3/company/" + companyId + "/purchaseorder/" + purchaseOrderId; String OAuthHeader = getOAuthHeader("GET", apiEndPoint); apiRequestHeadersMap.put("Authorization", OAuthHeader); RestResponse<JSONObject> apiRestResponse = sendJsonRestRequest(apiEndPoint, "GET", apiRequestHeadersMap); JSONObject apiResponseObject = apiRestResponse.getBody().getJSONObject("PurchaseOrder"); JSONArray apiLineArray = apiResponseObject.getJSONArray("Line"); Assert.assertEquals(connectorProperties.getProperty("ItemRef2"), apiLineArray.getJSONObject(0) .getJSONObject("ItemBasedExpenseLineDetail").getJSONObject("ItemRef").getString("value")); Assert.assertEquals(connectorProperties.getProperty("vendorRef"), apiResponseObject.getJSONObject("VendorRef").getString("value")); Assert.assertEquals(esbResponseObject.getJSONObject("MetaData").getString("CreateTime"), apiResponseObject.getJSONObject("MetaData").getString("CreateTime")); }
From source file:org.wso2.carbon.connector.integration.test.quickbooks.QuickbooksConnectorIntegrationTest.java
/** * Positive test case for query method with mandatory parameters. */// ww w . ja v a 2 s.c o m @Test(priority = 1, description = "quickbooks {query} integration test with mandatory parameters.") public void testQueryWithMandatoryParameters() throws IOException, JSONException { esbRequestHeadersMap.put("Action", "urn:query"); RestResponse<JSONObject> esbRestResponse = sendJsonRestRequest(proxyUrl, "POST", esbRequestHeadersMap, "esb_query_mandatory.json"); JSONObject esbResponseObject = esbRestResponse.getBody().getJSONObject("QueryResponse"); JSONArray esbAccountArray = esbResponseObject.getJSONArray("Account"); String apiEndPoint = connectorProperties.getProperty("apiUrl") + "/v3/company/" + companyId + "/query?query=select%20*%20from%20Account%20ORDERBY%20Id%20MAXRESULTS%2010"; String OAuthHeader = getOAuthHeader("GET", apiEndPoint); apiRequestHeadersMap.put("Authorization", OAuthHeader); RestResponse<JSONObject> apiRestResponse = sendJsonRestRequest(apiEndPoint, "GET", apiRequestHeadersMap); JSONObject apiResponseObject = apiRestResponse.getBody().getJSONObject("QueryResponse"); JSONArray apiAccountArray = apiResponseObject.getJSONArray("Account"); Assert.assertEquals(esbAccountArray.length(), apiAccountArray.length()); Assert.assertEquals(esbAccountArray.getJSONObject(0).getString("Name"), apiAccountArray.getJSONObject(0).getString("Name")); Assert.assertEquals(esbAccountArray.getJSONObject(0).getString("AccountType"), apiAccountArray.getJSONObject(0).getString("AccountType")); Assert.assertEquals(esbResponseObject.getString("maxResults"), apiResponseObject.getString("maxResults")); Assert.assertEquals(esbResponseObject.getString("startPosition"), apiResponseObject.getString("startPosition")); }
From source file:org.loklak.api.iot.GeoJsonPushServlet.java
@Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Query post = RemoteAccess.evaluate(request); String remoteHash = Integer.toHexString(Math.abs(post.getClientHost().hashCode())); // manage DoS if (post.isDoS_blackout()) { response.sendError(503, "your request frequency is too high"); return;/* w w w . j a v a 2 s.c o m*/ } String url = post.get("url", ""); String map_type = post.get("map_type", ""); String source_type_str = post.get("source_type", ""); if ("".equals(source_type_str) || !SourceType.isValid(source_type_str)) { DAO.log("invalid or missing source_type value : " + source_type_str); source_type_str = SourceType.GEOJSON.toString(); } SourceType sourceType = SourceType.GEOJSON; if (url == null || url.length() == 0) { response.sendError(400, "your request does not contain an url to your data object"); return; } String screen_name = post.get("screen_name", ""); if (screen_name == null || screen_name.length() == 0) { response.sendError(400, "your request does not contain required screen_name parameter"); return; } // parse json retrieved from url final JSONArray features; byte[] jsonText; try { jsonText = ClientConnection.download(url); JSONObject map = new JSONObject(new String(jsonText, StandardCharsets.UTF_8)); features = map.getJSONArray("features"); } catch (Exception e) { response.sendError(400, "error reading json file from url"); return; } if (features == null) { response.sendError(400, "geojson format error : member 'features' missing."); return; } // parse maptype Map<String, List<String>> mapRules = new HashMap<>(); if (!"".equals(map_type)) { try { String[] mapRulesArray = map_type.split(","); for (String rule : mapRulesArray) { String[] splitted = rule.split(":", 2); if (splitted.length != 2) { throw new Exception("Invalid format"); } List<String> valuesList = mapRules.get(splitted[0]); if (valuesList == null) { valuesList = new ArrayList<>(); mapRules.put(splitted[0], valuesList); } valuesList.add(splitted[1]); } } catch (Exception e) { response.sendError(400, "error parsing map_type : " + map_type + ". Please check its format"); return; } } JSONArray rawMessages = new JSONArray(); ObjectWriter ow = new ObjectMapper().writerWithDefaultPrettyPrinter(); PushReport nodePushReport = new PushReport(); for (Object feature_obj : features) { JSONObject feature = (JSONObject) feature_obj; JSONObject properties = feature.has("properties") ? (JSONObject) feature.get("properties") : new JSONObject(); JSONObject geometry = feature.has("geometry") ? (JSONObject) feature.get("geometry") : new JSONObject(); JSONObject message = new JSONObject(true); // add mapped properties JSONObject mappedProperties = convertMapRulesProperties(mapRules, properties); message.putAll(mappedProperties); if (!"".equals(sourceType)) { message.put("source_type", sourceType); } else { message.put("source_type", SourceType.GEOJSON); } message.put("provider_type", ProviderType.IMPORT.name()); message.put("provider_hash", remoteHash); message.put("location_point", geometry.get("coordinates")); message.put("location_mark", geometry.get("coordinates")); message.put("location_source", LocationSource.USER.name()); message.put("place_context", PlaceContext.FROM.name()); if (message.get("text") == null) { message.put("text", ""); } // append rich-text attachment String jsonToText = ow.writeValueAsString(properties); message.put("text", message.get("text") + MessageEntry.RICH_TEXT_SEPARATOR + jsonToText); if (properties.get("mtime") == null) { String existed = PushServletHelper.checkMessageExistence(message); // message known if (existed != null) { nodePushReport.incrementKnownCount(existed); continue; } // updated message -> save with new mtime value message.put("mtime", Long.toString(System.currentTimeMillis())); } try { message.put("id_str", PushServletHelper.computeMessageId(message, sourceType)); } catch (Exception e) { DAO.log("Problem computing id : " + e.getMessage()); nodePushReport.incrementErrorCount(); } rawMessages.put(message); } PushReport report = PushServletHelper.saveMessagesAndImportProfile(rawMessages, Arrays.hashCode(jsonText), post, sourceType, screen_name); String res = PushServletHelper.buildJSONResponse(post.get("callback", ""), report); post.setResponse(response, "application/javascript"); response.getOutputStream().println(res); DAO.log(request.getServletPath() + " -> records = " + report.getRecordCount() + ", new = " + report.getNewCount() + ", known = " + report.getKnownCount() + ", error = " + report.getErrorCount() + ", from host hash " + remoteHash); }
From source file:org.wso2.carbon.connector.integration.test.canvas.CanvasConnectorIntegrationTest.java
/** * Negative test case for createDiscussionTopic method. *//*from w w w. j a v a 2s .co m*/ @Test(groups = { "wso2.esb" }, dependsOnMethods = { "testCreateCourseWithMandatoryParameters" }, description = "canvas {createDiscussionTopic} integration test negative case.") public void testCreateDiscussionTopicNegativeCase() throws IOException, JSONException, InterruptedException { Thread.sleep(5000); esbRequestHeadersMap.put("Action", "urn:createDiscussionTopic"); RestResponse<JSONObject> esbRestResponse = sendJsonRestRequest(proxyUrl, "POST", esbRequestHeadersMap, "esb_createDiscussionTopic_negative.json"); String apiEndPoint = connectorProperties.getProperty("apiUrl") + "/api/v1/courses/" + connectorProperties.getProperty("courseId") + "/discussion_topics"; RestResponse<JSONObject> apiRestResponse = sendJsonRestRequest(apiEndPoint, "POST", apiRequestHeadersMap, "api_createDiscussionTopic_negative.json"); Assert.assertEquals(esbRestResponse.getHttpStatusCode(), apiRestResponse.getHttpStatusCode()); JSONObject esbErrorsObject = esbRestResponse.getBody().getJSONObject("errors"); String esbErrorAttribute = esbErrorsObject.getJSONArray("discussion_type").getJSONObject(0) .getString("attribute"); String esbErrorMessage = esbErrorsObject.getJSONArray("discussion_type").getJSONObject(0) .getString("message"); JSONObject apiErrorsObject = apiRestResponse.getBody().getJSONObject("errors"); String apiErrorAttribute = apiErrorsObject.getJSONArray("discussion_type").getJSONObject(0) .getString("attribute"); String apiErrorMessage = apiErrorsObject.getJSONArray("discussion_type").getJSONObject(0) .getString("message"); Assert.assertEquals(esbErrorAttribute, apiErrorAttribute); Assert.assertEquals(esbErrorMessage, apiErrorMessage); }
From source file:com.mifos.mifosxdroid.dialogfragments.loanchargedialog.LoanChargeDialogFragment.java
@Override public void showAllChargesV3(ResponseBody result) { /* Activity is null - Fragment has been detached; no need to do anything. */ if (getActivity() == null) return;/*www.j a v a2 s. com*/ Log.d(LOG_TAG, ""); final List<Charges> charges = new ArrayList<>(); // you can use this array to populate your spinner final ArrayList<String> chargesNames = new ArrayList<String>(); //Try to get response body BufferedReader reader = null; StringBuilder sb = new StringBuilder(); try { reader = new BufferedReader(new InputStreamReader(result.byteStream())); String line; while ((line = reader.readLine()) != null) { sb.append(line); } JSONObject obj = new JSONObject(sb.toString()); if (obj.has("chargeOptions")) { JSONArray chargesTypes = obj.getJSONArray("chargeOptions"); for (int i = 0; i < chargesTypes.length(); i++) { JSONObject chargesObject = chargesTypes.getJSONObject(i); Charges charge = new Charges(); charge.setId(chargesObject.optInt("id")); charge.setName(chargesObject.optString("name")); charges.add(charge); chargesNames.add(chargesObject.optString("name")); chargeNameIdHashMap.put(charge.getName(), charge.getId()); } } String stringResult = sb.toString(); } catch (Exception e) { Log.e(LOG_TAG, "", e); } final ArrayAdapter<String> chargesAdapter = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_spinner_item, chargesNames); chargesAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); sp_charge_name.setAdapter(chargesAdapter); sp_charge_name.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) { Id = chargeNameIdHashMap.get(chargesNames.get(i)); Log.d("chargesoptionss" + chargesNames.get(i), String.valueOf(Id)); if (Id != -1) { } else { Toast.makeText(getActivity(), getString(R.string.error_select_charge), Toast.LENGTH_SHORT) .show(); } } @Override public void onNothingSelected(AdapterView<?> parent) { } }); }
From source file:com.aniruddhc.acemusic.player.GMusicHelpers.GMusicClientCalls.java
/******************************************************************************************* * Sends a POST request to Google's servers and retrieves a JSONArray with all user * playlists. The JSONArray contains the fields of the playlist such as "id", "name", * "type", etc. (for a list of all response fields, see MobileClientPlaylistsSchema.java). * //from w w w . j a va2 s . co m * @return A JSONArray object that contains all user playlists and their fields. * @param context The context to use while retrieving user playlists. *******************************************************************************************/ public static final JSONArray getUserPlaylistsMobileClient(Context context) throws JSONException, IllegalArgumentException { JSONObject jsonRequestParams = new JSONObject(); JSONArray playlistsJSONArray = new JSONArray(); jsonRequestParams.put("max-results", 250); jsonRequestParams.put("start-token", "0"); mHttpClient.setUserAgent(mMobileClientUserAgent); String result = mHttpClient.post(context, "https://www.googleapis.com/sj/v1.1/playlistfeed?alt=json&hl=en_US&tier=basic", new ByteArrayEntity(jsonRequestParams.toString().getBytes()), "application/json"); JSONObject resultJSONObject = new JSONObject(result); JSONObject dataJSONObject = new JSONObject(); if (resultJSONObject != null) { dataJSONObject = resultJSONObject.optJSONObject("data"); } if (dataJSONObject != null) { playlistsJSONArray = dataJSONObject.getJSONArray("items"); } return playlistsJSONArray; }