Package net.sf.json

Examples of net.sf.json.JSONObject.keySet()


                    writer.writeAttribute(name, (String)value);
                } else if (value instanceof JSONObject) {
                    JSONObject valueObj = (JSONObject)value;
                    String namespace = null;
                    JSONObject valueAttrs = valueObj.getJSONObject("attributes");
                    for (Object vkey : valueAttrs.keySet()) {
                        namespace = valueAttrs.getString((String)vkey);
                        break;
                    }
                    String[] namesplit = name.split(":", 2);
                    writer.writeAttribute(namesplit[1], namespace, namesplit[0], valueObj.getString("value"));
View Full Code Here


    }

    private static void writeJsonObject(JSONObject object, StreamWriter writer) {
        String namespace = null;
        JSONObject valueAttrs = object.getJSONObject("attributes");
        for (Object vkey : valueAttrs.keySet()) {
            String svkey = (String)vkey;
            if (svkey.startsWith("xmlns:"))
                namespace = valueAttrs.getString(svkey);
            break;
        }
View Full Code Here

                    if (metadata.containsKey("isAgentActivity") &&
                            Boolean.valueOf(metadata.get("isAgentActivity").toString())) {
                        JSONObject json = JSONUtils
                                .flattenJSON(JSONObject.fromObject(metadata.get("payload")), null);

                        for (Object rawKey : json.keySet()) {
                            String key = rawKey.toString();
                            Object value = json.get(key);

                            // elapsed_time and generated are not metrics
                            if (key.equals("elapsed_time") || key.equals("generated")) {
View Full Code Here

                }
            }
        } else if (json instanceof JSONObject) {
            JSONObject jsonObject = (JSONObject)json;

            for (Object rawKey : jsonObject.keySet()) {
                String key = rawKey.toString();
                Object value = jsonObject.get(key);
                String flatKey = prefix + key;

                if (value instanceof JSONArray) {
View Full Code Here

        }

        if (json.containsKey("metadata")) {
            JSONObject rawMetadata = json.getJSONObject("metadata");

            for (Object rawKey : rawMetadata.keySet()) {
                metadata.put((String)rawKey, rawMetadata.get(rawKey));
            }
        }

View Full Code Here

                "arrayValue.2.1.plainValue"
        );
        JSONObject originalJSON = JSONObject.fromObject(JSONUtils.readJSONFromClasspath("JSONUtils-Test.json"));
        JSONObject flattenedJSON = JSONUtils.flattenJSON(originalJSON, "");

        assertEquals(flattenedJSON.keySet().size(), expectedKeys.size());

        for (Object rawKey : flattenedJSON.keySet()) {
            String key = rawKey.toString();

            Assert.assertTrue(expectedKeys.contains(key));
View Full Code Here

        JSONObject originalJSON = JSONObject.fromObject(JSONUtils.readJSONFromClasspath("JSONUtils-Test.json"));
        JSONObject flattenedJSON = JSONUtils.flattenJSON(originalJSON, "");

        assertEquals(flattenedJSON.keySet().size(), expectedKeys.size());

        for (Object rawKey : flattenedJSON.keySet()) {
            String key = rawKey.toString();

            Assert.assertTrue(expectedKeys.contains(key));
            assertEquals("Nodeable", flattenedJSON.getString(key));
        }
View Full Code Here

  public JSONObject processQueryParameters(HttpSession session, JSONObject json) {
    JSONObject tables = json.getJSONObject("parameters").getJSONObject("qparams");
    log.info(tables.toString());
    for (Object tObj : tables.entrySet()) {
      JSONObject table = (JSONObject) tObj;
      for (Object tKey : table.keySet()) {
        System.out.println((String) tKey);
        JSONArray columns = (JSONArray) table.get(tKey);

        for (Object cObj : columns) {
          JSONObject column = (JSONObject) cObj;
View Full Code Here

        System.out.println((String) tKey);
        JSONArray columns = (JSONArray) table.get(tKey);

        for (Object cObj : columns) {
          JSONObject column = (JSONObject) cObj;
          for (Object cKey : column.keySet()) {
            System.out.println("\t" + (String) cKey);
            JSONArray modifiers = (JSONArray) column.get(cKey);

            for (Object mObj : modifiers) {
              JSONObject modifier = (JSONObject) mObj;
View Full Code Here

            System.out.println("\t" + (String) cKey);
            JSONArray modifiers = (JSONArray) column.get(cKey);

            for (Object mObj : modifiers) {
              JSONObject modifier = (JSONObject) mObj;
              for (Object mKey : modifier.keySet()) {
                System.out.println("\t" + (String) mKey + " -> " + (String) modifier.get(mKey));
              }
            }
          }
        }
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.