Package org.json

Examples of org.json.JSONObject.keys()


        public void deserializeData() {
            try {
                Map<String, String> data = new HashMap<String, String>();
                if (StringUtils.isNotBlank(serializedData)) {
                    JSONObject jsonObject = new JSONObject(serializedData);
                    Iterator keys = jsonObject.keys();
                    while (keys.hasNext()) {
                        String key = (String) keys.next();
                        data.put(key, (String) jsonObject.get(key));
                    }
                }
View Full Code Here


        {
            try
            {
                JSONObject jo = new JSONObject( prefVal );
   
                for( Iterator i = jo.keys(); i.hasNext(); )
                {
                    String key = TextUtil.replaceEntities( (String)i.next() );
                    prefs.put(key, jo.getString(key) );
                }
            }
View Full Code Here

       
          long ts = 0;
          double value = 0;
          String jsonTs = null;
          String jsonValue = null;
          Iterator<String> it = jsonData.keys();
          while(it.hasNext())
          {
            jsonTs = it.next();
            jsonValue = jsonData.getString(jsonTs);
            try
View Full Code Here

      for ( int count = 0; count < cats.getLength(); count++ ) {
        results.add( cats.item( count ).getFirstChild().getTextContent() );
      }
    } else {
      JSONObject j = (JSONObject) temp;
      Iterator it = j.keys();
      while ( it.hasNext() ) {
        try {
          results.add( j.get( (String) it.next() ).toString() );
        }
        catch ( Exception ignored ) {
View Full Code Here

      } else {
        JSONArray temp = new JSONArray( json );
        JSONObject result = new JSONObject();
        for ( int count = 0; count < temp.length(); count++ ) {
          JSONObject obj = (JSONObject) temp.get( count );
          Iterator it = obj.keys();
          while ( it.hasNext() ) {
            String next = (String) it.next();
            result.put( next, obj.get( next ) );
          }
        }
View Full Code Here

    @SuppressWarnings("unchecked")
    public void load(JSONObject obj) throws JSONException {
        if (obj.has("entries") && !obj.isNull("entries")) {
            JSONObject entries = obj.getJSONObject("entries");
           
            Iterator<String> i = entries.keys();
            while (i.hasNext()) {
                String key = i.next();
                if (!entries.isNull(key)) {
                    Object o = entries.get(key);
                    _prefs.put(key, loadObject(o));
View Full Code Here

        if (obj.has("customMetadata") && !obj.isNull("customMetadata")) {
            try {
                JSONObject obj2 = obj.getJSONObject("customMetadata");
               
                @SuppressWarnings("unchecked")
                Iterator<String> keys = obj2.keys();
                while (keys.hasNext()) {
                    String key = keys.next();
                    Object value = obj2.get(key);
                    if (value != null && value instanceof Serializable) {
                        pm._customMetadata.put(key, (Serializable) value);
View Full Code Here

      if( null != nunaliitType && nunaliitType.equals(type) ){
        structures.add(jsonObj);
      }
     
      // Iterate over children structures
      Iterator<?> it = jsonObj.keys();
      while( it.hasNext() ){
        Object keyObj = it.next();
        if( keyObj instanceof String ){
          String key = (String)keyObj;
          Object value = jsonObj.opt(key);
View Full Code Here

    }

    public void initFromConfigString(String oauthConfigStr) throws GadgetException {
        try {
            JSONObject oauthConfigs = new JSONObject(oauthConfigStr);
            for (Iterator<?> i = oauthConfigs.keys(); i.hasNext();) {
                String url = (String) i.next();
                URI gadgetUri = new URI(url);
                JSONObject oauthConfig = oauthConfigs.getJSONObject(url);
                storeConsumerInfos(gadgetUri, oauthConfig);
            }
View Full Code Here

    if( null != nunaliitAttachments ){
      files = nunaliitAttachments.optJSONObject("files");
    }
   
    if( null != files ){
      Iterator<?> keyIt = files.keys();
      while( keyIt.hasNext() ){
        Object keyObj = keyIt.next();
        if( keyObj instanceof String ){
          String attName = (String)keyObj;
          JSONObject attachment = files.optJSONObject(attName);
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.