Package org.json

Examples of org.json.JSONObject.keys()


  public LoggingPreferences getLoggingPreferences() throws JSONException {
    LoggingPreferences ret = new LoggingPreferences();
    JSONObject json = (JSONObject) getCapability(CapabilityType.LOGGING_PREFS);
    if (json != null) {
      for (Object key : ImmutableList.copyOf(json.keys())) {
        String logType = (String) key;
        Level level = Level.parse((String) json.get(logType));
        ret.enable(logType, level);
      }
    }
View Full Code Here


  private void fromJSON(final JSONObject opLoadObject) throws JSONException {
    final JSONObject prefixList = opLoadObject.getJSONObject("PREFIXLIST");
    @SuppressWarnings("unchecked")
    final
    Iterator<String> keyIt = prefixList.keys();
    while(keyIt.hasNext()) {
      final String key = keyIt.next();
      this.prefixList.put(key, prefixList.getString(key));
    }
  }
View Full Code Here

    if(loadObject.has("connections")) {
      JSONObject connectionsLoadObject = loadObject.getJSONObject("connections");

      RuleConnection ruleConnection = new RuleConnection(this.visualEditor, this);

      keyIt = connectionsLoadObject.keys();

      while(keyIt.hasNext()) {
        String parentName = keyIt.next();
        JSONArray connections = connectionsLoadObject.getJSONArray(parentName);
View Full Code Here

      // parse JSON-encoded string
      JSONObject obj = new JSONObject(jsonStr);

      // process each key (keys = station IDs)
      @SuppressWarnings("unchecked")
      Iterator<String> it = obj.keys();
      while (it.hasNext()) {
        String key = it.next();
        StationInfo si = parseStationDataSet(obj, key);
        if (si != null) {
          result.put(si.id, si);
View Full Code Here

      // parse JSON-encoded string
      JSONObject obj = new JSONObject(jsonStr);

      // process each key (keys = train IDs)
      @SuppressWarnings("unchecked")
      Iterator<String> it = obj.keys();
      while (it.hasNext()) {
        String key = it.next();
        result.add(parseTrainDataSet(obj, key));
      }
    } catch (Exception e) {
View Full Code Here

        ObjectMatch returnValue = new ObjectMatch(-1);
        state.setSerialized(o, returnValue);

        ObjectMatch m = null;
        ObjectMatch tmp;
        i = jso.keys();
        while (i.hasNext()) {
            String field = (String) i.next();
            Method setMethod = (Method) bd.writableProps.get(field);
            if (setMethod != null) {
                try {
View Full Code Here

                    + clazz.getName(), e);
        }
        state.setSerialized(o, instance);
        Object invokeArgs[] = new Object[1];
        Object fieldVal;
        Iterator i = jso.keys();
        while (i.hasNext()) {
            String field = (String) i.next();
            Method setMethod = (Method) bd.writableProps.get(field);
            if (setMethod != null) {
                try {
View Full Code Here

            throw new UnmarshallException("map missing");
        }
        ObjectMatch m = new ObjectMatch(-1);
        state.setSerialized(o, m);

        Iterator i = jsonmap.keys();
        String key = null;
        try {
            while (i.hasNext()) {
                key = (String) i.next();
                m.setMismatch(_ser.tryUnmarshall(state, null, jsonmap.get(key)).max(m).getMismatch());
View Full Code Here

            throw new UnmarshallException("map missing");
        }

        state.setSerialized(o, ht);

        Iterator i = jsonmap.keys();
        String key = null;
        try {
            while (i.hasNext()) {
                key = (String) i.next();
                ht.put(key, _ser.unmarshall(state, null, jsonmap.get(key)));
View Full Code Here

            throw new UnmarshallException("set missing");
        }

        ObjectMatch m = new ObjectMatch(-1);
        state.setSerialized(o, m);
        Iterator i = jsonset.keys();
        String key = null;

        try {
            while (i.hasNext()) {
                key = (String) i.next();
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.