Package org.json

Examples of org.json.JSONObject.keySet()


                    visibilityJson.addWorkspace(workspacesJson.getString(i));
                }
                return visibilityJson;
            }
            Map<String, Object> result = new HashMap<String, Object>();
            for (Object key : json.keySet()) {
                String keyStr = (String) key;
                result.put(keyStr, toClientApiValue(json.get(keyStr)));
            }
            return result;
        } else if (value instanceof String) {
View Full Code Here


        JSONObject results = new JSONObject();
        JSONArray audits = new JSONArray();
        for (Audit audit : rows) {
            JSONObject data = audit.toJson();
            if (data.keySet().contains(AuditEntity.ENTITY_AUDIT) && !getPrivileges(user).contains(Privilege.ADMIN)) {
                continue;
            }
            audits.put(data);
        }
        results.put("auditHistory", audits);
View Full Code Here

        JSONObject results = new JSONObject();
        JSONArray audits = new JSONArray();
        for (Audit audit : rows) {
            JSONObject data = audit.toJson();
            if (data.keySet().contains(AuditEntity.ENTITY_AUDIT) && !getPrivileges(user).contains(Privilege.ADMIN)) {
                continue;
            }
            audits.put(data);
        }
        results.put("auditHistory", audits);
View Full Code Here

    public static Map<String, Object> metadataStringToMap(String metadataString) {
        Map<String, Object> metadata = new HashMap<String, Object>();
        if (metadataString != null && metadataString.length() > 0) {
            JSONObject metadataJson = new JSONObject(metadataString);
            for (Object keyObj : metadataJson.keySet()) {
                String key = "" + keyObj;
                metadata.put(key, metadataJson.get(key));
            }
        }
        return metadata;
View Full Code Here

    String colList = request.getParameter(Arguments.columnList.name());
    ArrayList<HashMap<String, String>> cols = new ArrayList<HashMap<String, String>>();
    try {
     
      JSONObject arr = new JSONObject(colList);
      for(int i=0; i<arr.keySet().size(); i++) {
        JSONObject obj = arr.getJSONObject(String.valueOf(i));
        HashMap<String, String> map = new HashMap<String, String>();
        map.put("url", obj.getString("url"));
        map.put("name", obj.getString("name"));
        cols.add(map);
View Full Code Here

           
            // set the heritable data from the parent url, passed back to us via amqp
            // XXX brittle, only goes one level deep, and only handles strings and arrays, the latter of which it converts to a Set.
            // 'heritableData': {'source': 'https://facebook.com/whitehouse/', 'heritable': ['source', 'heritable']}
            JSONObject heritableData = parentUrlMetadata.getJSONObject("heritableData");
            for (String key: (Set<String>) heritableData.keySet()) {
                Object value = heritableData.get(key);
                if (value instanceof JSONArray) {
                    Set<String> valueSet = new HashSet<String>();
                    JSONArray arr = ((JSONArray) value);
                    for (int i = 0; i < arr.length(); i++) {
View Full Code Here

    try {
      if(data.opt("data") != null) {
        JSONObject query = (JSONObject) data.get("data");
        try {
         
          Iterator it = query.keySet().iterator();
          if(it.hasNext()) {
            url += "?";
          }
          while(it.hasNext()) {
            String key = (String) it.next();
View Full Code Here

    JSONObject json = new JSONObject(content);

    SimpleConfigMetadataRepository repository = new SimpleConfigMetadataRepository();
    if (json.has(GROUPS)) {
      JSONObject rootGroups = json.getJSONObject(GROUPS);
      for (Object o : rootGroups.keySet()) {
        String groupName = (String) o;
        JSONObject rootGroup = rootGroups.getJSONObject(groupName);
        ConfigMetadataGroup group = ConfigMetadataGroup.root(groupName);
        readGroup(rootGroup, group);
        repository.registerRootGroup(group);
View Full Code Here

      }
    }
    if (json.has(ITEMS)) {
      ConfigMetadataGroup group = ConfigMetadataGroup.root("");
      JSONObject items = json.getJSONObject(ITEMS);
      for (Object o : items.keySet()) {
        String itemName = (String) o;
        JSONObject item = items.getJSONObject(itemName);
        group.registerItem(readItem(group, item, itemName));
      }
      repository.registerRootGroup(group);
View Full Code Here

      group.addType(json.getString(TYPE_ATTRIBUTE));
    }
    // items
    if (json.has(ITEMS)) {
      JSONObject items = json.getJSONObject(ITEMS);
      for (Object o : items.keySet()) {
        String itemName = (String) o;
        JSONObject item = items.getJSONObject(itemName);
        group.registerItem(readItem(group, item, itemName));
      }
    }
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.