Package org.json.simple

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


        assertNotNull("expecing deletionInfo to be present", serializedDeletionInfo);

        assertEquals(
                "unexpected serialization format for topLevelDeletion",
                "{\"markedForDeleteAt\":0,\"localDeletionTime\":0}",
                serializedDeletionInfo.toJSONString());

        // check the colums are what we put in
        JSONArray cols = (JSONArray) row.get("columns");
        assertNotNull("expecing columns to be present", cols);
        assertEquals("expecting two columns", 2, cols.size());
View Full Code Here


        assertNotNull("expecing deletionInfo to be present", serializedDeletionInfo);

        assertEquals(
                "unexpected serialization format for topLevelDeletion",
                "{\"markedForDeleteAt\":0,\"localDeletionTime\":0}",
                serializedDeletionInfo.toJSONString());

        // check the colums are what we put in
        JSONArray cols = (JSONArray) row.get("cells");
        assertNotNull("expecing columns to be present", cols);
        assertEquals("expecting two columns", 2, cols.size());
View Full Code Here

                return result;
            }
            if (answer == 0) {
                JSONObject json = new JSONObject();
                json.put(JsonTags.JMS_TOPIC_NAME, "topicName");
                result = new ByteArrayInputStream(json.toJSONString().getBytes());

            }
            if (answer == 1) {
                JSONObject json = new JSONObject();
                result = new ByteArrayInputStream(json.toJSONString().getBytes());
View Full Code Here

                result = new ByteArrayInputStream(json.toJSONString().getBytes());

            }
            if (answer == 1) {
                JSONObject json = new JSONObject();
                result = new ByteArrayInputStream(json.toJSONString().getBytes());

            }
            if (answer == 2) {
                JSONObject json = new JSONObject();
                List<WorkflowJobBean> jsonWorkflows = new ArrayList<WorkflowJobBean>();
View Full Code Here

            if (answer == 2) {
                JSONObject json = new JSONObject();
                List<WorkflowJobBean> jsonWorkflows = new ArrayList<WorkflowJobBean>();
                jsonWorkflows.add(new WorkflowJobBean());
                json.put(JsonTags.BUNDLE_JOBS, WorkflowJobBean.toJSONArray(jsonWorkflows, "GMT"));
                result = new ByteArrayInputStream(json.toJSONString().getBytes());

            }
            if (answer == 3) {
                JSONObject json = new JSONObject();
                List<BulkResponseImpl> jsonWorkflows = new ArrayList<BulkResponseImpl>();
View Full Code Here

                action.setStatus(Status.READY);
                bulk.setAction(action);
                jsonWorkflows.add(bulk);
                jsonWorkflows.add(bulk);
                json.put(JsonTags.BULK_RESPONSES, BulkResponseImpl.toJSONArray(jsonWorkflows, "GMT"));
                result = new ByteArrayInputStream(json.toJSONString().getBytes());

            }

            return result;
        }
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

        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

    private WebApplicationException newApplicationError(Status status, String error, String description) {
        JSONObject errorObject = new JSONObject();
        errorObject.put("error", error);
        errorObject.put("description", description);
        return new WebApplicationException(Response.status(status).entity(errorObject.toJSONString()).build());
    }

    /**
     * generic information about the institution
     *
 
View Full Code Here

    groupList.put(Integer.parseInt(groupIdString), g);
    JSONObject jsonObject = new JSONObject();
    jsonObject.put("result", "group added");

    return jsonObject.toJSONString();

  }

  /**
   * method to edit group, avoid for now
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.