Package org.json.simple

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


        // Export to JSON and verify
        File tempJson = File.createTempFile("CFWithDeletionInfo", ".json");
        SSTableExport.export(reader, new PrintStream(tempJson.getPath()), new String[0]);

        JSONArray json = (JSONArray)JSONValue.parseWithException(new FileReader(tempJson));
        System.out.println(json.toJSONString());
        assertEquals("unexpected number of rows", 1, json.size());

        JSONObject row = (JSONObject)json.get(0);
        assertEquals("unexpected number of keys", 3, row.keySet().size());
        assertEquals("unexpected row key",asHex("rowA"),row.get("key"));
View Full Code Here


        // Export to JSON and verify
        File tempJson = File.createTempFile("CFWithDeletionInfo", ".json");
        SSTableExport.export(reader, new PrintStream(tempJson.getPath()), new String[0]);

        JSONArray json = (JSONArray)JSONValue.parseWithException(new FileReader(tempJson));
        System.out.println(json.toJSONString());
        assertEquals("unexpected number of rows", 1, json.size());

        JSONObject row = (JSONObject)json.get(0);
        assertEquals("unexpected number of keys", 3, row.keySet().size());
        assertEquals("unexpected row key",asHex("rowA"),row.get("key"));
View Full Code Here

        // Export to JSON and verify
        File tempJson = File.createTempFile("CFWithDeletionInfo", ".json");
        SSTableExport.export(reader, new PrintStream(tempJson.getPath()), new String[0]);

        JSONArray json = (JSONArray)JSONValue.parseWithException(new FileReader(tempJson));
        System.out.println(json.toJSONString());
        assertEquals("unexpected number of rows", 1, json.size());

        JSONObject row = (JSONObject)json.get(0);
        assertEquals("unexpected number of keys", 3, row.keySet().size());
        assertEquals("unexpected row key",asHex("rowA"),row.get("key"));
View Full Code Here

                    for (AbstractBackupPath filePath : flist)
                    {
                        if (filePath.type == BackupFileType.SNAP)
                            jsonObj.add(filePath.getRemotePath());
                    }
                    fr.write(jsonObj.toJSONString());
                }
                finally
                {
                    IOUtils.closeQuietly(fr);
                }
View Full Code Here

                    for (AbstractBackupPath filePath : flist)
                    {
                        if (filePath.type == BackupFileType.SNAP)
                            jsonObj.add(filePath.getRemotePath());
                    }
                    fr.write(jsonObj.toJSONString());
                }
                finally
                {
                    IOUtils.closeQuietly(fr);
                }
View Full Code Here

        try
        {
            JSONArray jsonObj = new JSONArray();
            for (AbstractBackupPath filePath : bps)
                jsonObj.add(filePath.getRemotePath());
            fr.write(jsonObj.toJSONString());
        }
        finally
        {
            IOUtils.closeQuietly(fr);
        }
View Full Code Here

                  JSONObject obj = new JSONObject();
                  obj.put("name", dialServer.getFriendlyName());
                  obj.put("ip_address", dialServer.getIpAddress().getHostAddress());
                  list.add(obj);
                }
                return new Response(HttpServer.HTTP_OK, "text/plain", list.toJSONString());
              }
            } else if (method.equals("POST")) {
              if (uri.startsWith(prefixes[0])) { // playback
                String device = parms.getProperty("device");
                if (device != null) {
View Full Code Here

        // Export to JSON and verify
        File tempJson = File.createTempFile("CFWithDeletionInfo", ".json");
        SSTableExport.export(reader, new PrintStream(tempJson.getPath()), new String[0]);

        JSONArray json = (JSONArray)JSONValue.parseWithException(new FileReader(tempJson));
        System.out.println(json.toJSONString());
        assertEquals("unexpected number of rows", 1, json.size());

        JSONObject row = (JSONObject)json.get(0);
        assertEquals("unexpected number of keys", 3, row.keySet().size());
        assertEquals("unexpected row key",asHex("rowA"),row.get("key"));
View Full Code Here

    JSONArray jsonArray = new JSONArray();
      for (FlowNode node : flow.getFlowNodes()) {
        jsonArray.add(node.getAlias());
      }
   
      return jsonArray.toJSONString();
    }
   
  @SuppressWarnings("unchecked")
  private String createJsonFlow(Flow flow) {
    JSONObject jsonFlow = new JSONObject();
View Full Code Here

        Flow flow = manager.getFlow(root);
        JSONObject flowObj = getJSONDependencyTree(flow);
        rootJobObj.add(flowObj);
      }
     
      return rootJobObj.toJSONString();
    }
   
    @SuppressWarnings("unchecked")
  private JSONObject getJSONDependencyTree(Flow flow) {
      JSONObject jobObject = new JSONObject();
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.