Package org.json

Examples of org.json.JSONObject.keys()


        if (jsonset == null) {
            throw new UnmarshallException("set missing");
        }

        Iterator i = jsonset.keys();
        String key = null;
        state.setSerialized(o, abset);
        try {
            while (i.hasNext()) {
                key = (String) i.next();
View Full Code Here


        }
        if (jsonmap == null) {
            throw new UnmarshallException("map missing");
        }
        ObjectMatch m = new ObjectMatch(-1);
        Iterator i = jsonmap.keys();
        String key = null;
        state.setSerialized(o, m);
        try {
            while (i.hasNext()) {
                key = (String) i.next();
View Full Code Here

        }
        if (jsonmap == null) {
            throw new UnmarshallException("map missing");
        }
        state.setSerialized(o, abmap);
        Iterator i = jsonmap.keys();
        String key = null;
        try {
            while (i.hasNext()) {
                key = (String) i.next();
                abmap.put(key, _ser.unmarshall(state, null, jsonmap.get(key)));
View Full Code Here

            // check to see if this gadget has at least one non-hidden user pref
            // to determine if we should display the edit prefs button
            boolean hasPrefsToEdit = false;
            if (responseObject.has(USER_PREFS)) {
                JSONObject userPrefs = responseObject.getJSONObject(USER_PREFS);
                Iterator keys = userPrefs.keys();
                while(keys.hasNext()) {
                    String userPrefName = (String) keys.next();
                    JSONObject userPref = userPrefs.getJSONObject(userPrefName);
                    if (!PrefDataTypes.HIDDEN.toString().equals(userPref.getString(DATA_TYPE))) {
                        hasPrefsToEdit = true;
View Full Code Here

      JSONObject personData = getDb().getJSONObject(DATA_TABLE).optJSONObject(id);
      if (personData != null) {
        if (fields.contains(Person.Field.APP_DATA.toString())) {
          appData = Maps.newHashMap();
          @SuppressWarnings("unchecked")
          Iterator<String> keys = personData.keys();
          while (keys.hasNext()) {
            String key = keys.next();
            appData.put(key, personData.get(key));
          }
        } else {
View Full Code Here

        // TODO: We can use the converter here to do this for us

        // JSONObject keys are always strings
        @SuppressWarnings("unchecked")
        Iterator<String> keys = personData.keys();
        Map<String, String> data = Maps.newHashMap();
        while (keys.hasNext()) {
          String key = keys.next();
          data.put(key, personData.getString(key));
        }
View Full Code Here

      JSONObject newPersonData = new JSONObject();
      JSONObject oldPersonData = getDb().getJSONObject(DATA_TABLE).getJSONObject(user);

      // JSONObject keys are always strings
      @SuppressWarnings("unchecked")
      Iterator<String> keys = oldPersonData.keys();
      while (keys.hasNext()) {
        String key = keys.next();
        if (!fields.contains(key)) {
          newPersonData.put(key, oldPersonData.getString(key));
        }
View Full Code Here

                            String key = ( String ) entry.get( "key" );
                            if ( "nfo".equals( key ) )
                            {
                                // BundleInfo (see #bundleInfo & #bundleInfoDetails
                                JSONObject infos = ( JSONObject ) entry.get( "value" );
                                Iterator infoKeys = infos.keys();
                                while ( infoKeys.hasNext() )
                                {
                                    String infoKey = ( String ) infoKeys.next();
                                    pw.println( "    " + infoKey + ": " );
View Full Code Here

      return;
    }

    if (current instanceof JSONObject) {
      JSONObject json = (JSONObject) current;
      Iterator<?> keys = json.keys();
      while (keys.hasNext()) {
        String key = (String) keys.next();
        if (json.isNull(key)) {
          result.put(prefix + '.' + key, "null");
        } else {
View Full Code Here

        JSONObject prefs = json.optJSONObject("prefs");
        if (prefs == null) {
            return null;
        }
        Map<String, String> p = Maps.newHashMap();
        Iterator i = prefs.keys();
        while (i.hasNext()) {
            String key = (String) i.next();
            p.put(key, prefs.getString(key));
        }
        return new UserPrefs(p);
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.