Package org.json.simple

Examples of org.json.simple.JSONObject.toJSONString()


      }
      JSONObject jsonObject = DataTransformer.getJSONTree(paramPath, paramDepth, elems);
     
      String ans = null;
      if (jsonObject != null) {
       ans = jsonObject.toJSONString();
      }
     
      if (ans == null) {
        lines.add("{ \"children\": [] }");
      } else {
View Full Code Here


          n.fileSize = entries[1];
          nlist.add(n);
          line = l.readLine();
        }
        JSONObject ans = DataTransformer.getJSONTree("/", 2, nlist);
        System.out.println(ans.toJSONString());
//        assertTrue( true );
    }
}
View Full Code Here

   
    public void postBulk(JSONArray docs) throws IOException, CouchDBException {
        // @todo need to handle responses
        JSONObject obj = new JSONObject();
        obj.put("docs", docs);
        postBulk(obj.toJSONString());
    }
   
    public void postBulk(String content) throws IOException, CouchDBException {
        CouchDBResponse resp = client.post(uri(BULK_DOCS),content);
        // @todo need to handle responses
View Full Code Here

            if (err.containsKey("reason")) {
                res = res == null ? "" : res + ",";
                res = res + err.get("reason").toString();
            }
            if (res == null) {
                res = err.toJSONString();
            }
            return res;
        } else {
            throw new IllegalStateException("not an error");
        }
View Full Code Here

    // Extract all form inputs including sensitive inputs
    JSONObject jobJson = jobBean.extract(false);

    String response = super.post(serverUrl + RESOURCE,
      jobJson.toJSONString());

    ValidationBean validationBean = new ValidationBean();
    validationBean.restore((JSONObject) JSONValue.parse(response));

    return validationBean;
View Full Code Here

    // Extract all form inputs including sensitive inputs
    JSONObject jobJson = jobBean.extract(false);

    String response = super.put(serverUrl + RESOURCE + job.getPersistenceId(),
                                jobJson.toJSONString());

    ValidationBean validationBean = new ValidationBean();
    validationBean.restore((JSONObject) JSONValue.parse(response));

    return validationBean;
View Full Code Here

    // Extract all form inputs including sensitive inputs
    JSONObject connectionJson = connectionBean.extract(false);

    String response = super.post(serverUrl + RESOURCE,
                                 connectionJson.toJSONString());

    ValidationBean validationBean = new ValidationBean();
    validationBean.restore((JSONObject) JSONValue.parse(response));

    return validationBean;
View Full Code Here

    // Extract all form inputs including sensitive inputs
    JSONObject connectionJson = connectionBean.extract(false);

    String response = super.put(serverUrl + RESOURCE
                                  + connection.getPersistenceId(),
                                connectionJson.toJSONString());

    ValidationBean validationBean = new ValidationBean();
    validationBean.restore((JSONObject) JSONValue.parse(response));

    return validationBean;
View Full Code Here

                                                      "ID swap should have happened in launcher job [{0}]", action.getExternalId());
                }
                Counters counters = runningJob.getCounters();
                if (counters != null) {
                    JSONObject json = counterstoJson(counters);
                    context.setVar(HADOOP_COUNTERS, json.toJSONString());
                }
                else {

                    context.setVar(HADOOP_COUNTERS, "");
View Full Code Here

        JSONObject obj = new JSONObject();
        for (String key : doc.keySet()) {
            Object value = doc.get(key);
            obj.put(key, value);
        }
        return obj.toJSONString();
    }

    private <T extends Document> T fromString(Collection<T> collection, String data) throws ParseException {
        T doc = collection.newDocument(this);
        Map<String, Object> obj = (Map<String, Object>) new JSONParser().parse(data);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.