Package org.json.simple

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


            sb.append(hadoopId);
            // Hadoop Counters for pig created MR job
            pigStatsGroup.put(hadoopId, toJSONFromJobStats(jobStats));
        }
        pigStatsGroup.put("JOB_GRAPH", sb.toString());
        return pigStatsGroup.toJSONString();
    }

    // MR job related counters
    @SuppressWarnings("unchecked")
    private static JSONObject toJSONFromJobStats(JobStats jobStats) {
View Full Code Here


        // A BSN shouldn't need escaping, but anyway...
        o.put("bsn", JSONObject.escape(bsn.getKey()));
        o.put("rating", rating.getKey());
        o.put("comment", comment == null ? "" : JSONObject.escape(comment));
        final String customJson = o.toJSONString();

        // Register the feedback. Note we record all feedback against the BSN
        // for the RooBot client add-on to assist simple server-side detection.
        // We do NOT record feedback against the BSN that is receiving the
        // feedback (as the BSN receiving the feedback is stored inside the
View Full Code Here

        json.put("id", ++counter);
        if (authKey != null) {
            json.put("authKey", authKey);
        }

        writer.println(json.toJSONString());
        writer.flush();
        try {
            String resStr = reader.readLine();
            Object obj = parser.parse(resStr);
View Full Code Here

      final ErrorCode code, final int serial) {
    final JSONObject ret = new JSONObject();
    ret.put(AjaxResponse.ERROR, Boolean.TRUE);
    ret.put(AjaxResponse.ERROR_CODE, code.toString());
    ret.put(AjaxResponse.SERIAL, String.valueOf(serial));
    writer.println(ret.toJSONString());
  }

  /**
   * Return response data to the client.
   *
 
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

      JSONObject object = new JSONObject();
      object.put("prefix", prefix); //$NON-NLS-1$
      object.put("suffix", SUFFIX); //$NON-NLS-1$

      return NLS.bind(Messages.HardcodedSourceWrapProvider_DESCRIPTION, getSpecialization(),
          object.toJSONString());
    }

    protected abstract String getSpecialization();
  }
View Full Code Here

            sb.append(hadoopId);
            // Hadoop Counters for pig created MR job
            pigStatsGroup.put(hadoopId, toJSONFromJobStats(jobStats));
        }
        pigStatsGroup.put("JOB_GRAPH", sb.toString());
        return pigStatsGroup.toJSONString();
    }

    // MR job related counters
    @SuppressWarnings("unchecked")
    private static JSONObject toJSONFromJobStats(JobStats jobStats) {
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

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.