public String toJSONString(){ return toJSONString(this); }
public String toString() { return toJSONString(); }
@SuppressWarnings("unchecked") @Override public String toJSONString() { JSONArray jsonArray = new JSONArray(); for(String kw : keywords) { JSONObject data = new JSONObject(); data.put("name", kw); data.put("value", kw); jsonArray.add(data); } return jsonArray.toJSONString(); }
return JSONArray.toJSONString((List)value);
public AbstractBackupPath set(List<AbstractBackupPath> bps, String snapshotName) throws Exception { File metafile = createTmpMetaFile(); try (FileWriter fr = new FileWriter(metafile)) { JSONArray jsonObj = new JSONArray(); for (AbstractBackupPath filePath : bps) jsonObj.add(filePath.getRemotePath()); fr.write(jsonObj.toJSONString()); } AbstractBackupPath backupfile = decorateMetaJson(metafile, snapshotName); fs.uploadFile( Paths.get(backupfile.getBackupFile().getAbsolutePath()), Paths.get(backupfile.getRemotePath()), backupfile, 10, true); addToRemotePath(backupfile.getRemotePath()); return backupfile; }
@Override protected void downloadFileImpl(Path remotePath, Path localPath) throws BackupRestoreException { AbstractBackupPath path = pathProvider.get(); path.parseRemote(remotePath.toString()); if (path.getType() == AbstractBackupPath.BackupFileType.META) { // List all files and generate the file try (FileWriter fr = new FileWriter(localPath.toFile())) { JSONArray jsonObj = new JSONArray(); for (AbstractBackupPath filePath : flist) { if (filePath.type == AbstractBackupPath.BackupFileType.SNAP && filePath.time.equals(path.time)) { jsonObj.add(filePath.getRemotePath()); } } fr.write(jsonObj.toJSONString()); fr.flush(); } catch (IOException io) { throw new BackupRestoreException(io.getMessage(), io); } } downloadedFiles.add(remotePath.toString()); }
public String toString() { return toJSONString(); }
public String toJSONString(){ return toJSONString(this); }
return JSONArray.toJSONString((List)value);
/** * Get an HTTP Request for requesting multiples requests at once * * @param pRequests requests to put into a HTTP request * @return HTTP request to send to the server */ public <T extends J4pRequest> HttpUriRequest getHttpRequest(List<T> pRequests,Map<J4pQueryParameter,String> pProcessingOptions) throws UnsupportedEncodingException, URISyntaxException { JSONArray bulkRequest = new JSONArray(); String queryParams = prepareQueryParameters(pProcessingOptions); HttpPost postReq = new HttpPost(createRequestURI(j4pServerUrl.getPath(),queryParams)); for (T request : pRequests) { JSONObject requestContent = getJsonRequestContent(request); bulkRequest.add(requestContent); } postReq.setEntity(new StringEntity(bulkRequest.toJSONString(),"utf-8")); return postReq; }
print(statuses.toJSONString()); return;
print(statuses.toJSONString()); return;
/** * Returns a string representation of this array. This is equivalent to * calling {@link JSONArray#toJSONString()}. */ public String toString() { return toJSONString(); } }
/** * Returns a string representation of this array. This is equivalent to * calling {@link JSONArray#toJSONString()}. */ public String toString() { return toJSONString(); } }
public static CardsList create() throws Exception { CardsList instance = new CardsList(); JSONParser parser = new JSONParser(); Reader reader = new BufferedReader( new InputStreamReader(CardsList.class.getResourceAsStream("cards.json"), "UTF-8")); String cardsString = ((org.json.simple.JSONArray) parser.parse(reader)).toJSONString(); ObjectMapper mapper = new ObjectMapper(); instance.dbCards = mapper.readValue(cardsString, TypeFactory.defaultInstance().constructCollectionType(List.class, DbCard.class)); return instance; }
@SuppressWarnings("unchecked") @Override public String toJSONString() { JSONArray jsonArray = new JSONArray(); for(String kw : keywords) { JSONObject data = new JSONObject(); data.put("name", kw); data.put("value", kw); jsonArray.add(data); } return jsonArray.toJSONString(); }
private static String[] jsonObjValToStringArr(String inputString, String subObjPropertyName) throws Exception { JSONObject jsonObj = (JSONObject) JSONValue.parse(inputString); JSONArray jsonArr = (JSONArray) jsonObj.get(subObjPropertyName); return jsonArrToStringArr(jsonArr.toJSONString(), null); }
public static String listToJSON(Object... args) { JSONArray o = new JSONArray(); for (Object a : args) { o.add(a); } return o.toJSONString(); }
@SuppressWarnings("unchecked") public String toJSONString() { JSONArray parts = new JSONArray(); for (final MessagePart part : messageParts) { parts.add(part.toJson()); } return parts.toJSONString(); }
@Override public String toString() { JSONArray jsonArray = new JSONArray(); jsonArray.add(_weight); jsonArray.add(_startBin); jsonArray.add(_endBin); return jsonArray.toJSONString(); }