Package org.json

Examples of org.json.JSONObject.opt()


      JSONObject json = new JSONObject(jsonString);
     
      Assert.assertNotNull(json.get("weather"));
      Assert.assertNotNull(json.get("features"));
     
      Assert.assertNull(json.opt("demographics"));
    } catch (IOException e) {
      Assert.fail(e.getMessage());
    } catch (JSONException e) {
      Assert.fail(e.getMessage());
    }
View Full Code Here


      String jsonString = client.getContext(lat, lon, queryParams);
      JSONObject json = new JSONObject(jsonString);
     
      Assert.assertNotNull(json.get("demographics"));
     
      Assert.assertNull(json.opt("weather"));
      Assert.assertNull(json.opt("features"));
    } catch (IOException e) { 
      Assert.fail(e.getMessage());
    } catch (JSONException e) {
      Assert.fail(e.getMessage());
View Full Code Here

      JSONObject json = new JSONObject(jsonString);
     
      Assert.assertNotNull(json.get("demographics"));
     
      Assert.assertNull(json.opt("weather"));
      Assert.assertNull(json.opt("features"));
    } catch (IOException e) { 
      Assert.fail(e.getMessage());
    } catch (JSONException e) {
      Assert.fail(e.getMessage());
    }
View Full Code Here

      return new Result<List<TenpayAddress>>(error);
    }
    List<TenpayAddress> addresses = new ArrayList<TenpayAddress>();
    Integer total = Result.parseInteger(jsonObject.get("ret_num"));
    for (int i = 0; i < total; i++) {
      Integer index = Result.parseInteger(jsonObject.opt("Findex_" + i));
      if (index == null) {
        break;
      }
      TenpayAddress address = new TenpayAddress();
      address.setTotal(total);
View Full Code Here

        break;
      }
      TenpayAddress address = new TenpayAddress();
      address.setTotal(total);
      address.setIndex(index);
      address.setRegionId(Result.parseInteger(jsonObject.opt("FRegionId_" + i)));
      address.setStreet(jsonObject.optString("Faddrstreet_" + i));
      address.setZipcode(Result.toString(jsonObject.opt("Fzipcode_" + i)));
      address.setMobile(Result.toString(jsonObject.opt("Fmobile_" + i)));
      address.setTel(Result.toString(jsonObject.opt("Ftel_" + i)));
      address.setName(Result.toString(jsonObject.opt("Fname_" + i)));
View Full Code Here

      TenpayAddress address = new TenpayAddress();
      address.setTotal(total);
      address.setIndex(index);
      address.setRegionId(Result.parseInteger(jsonObject.opt("FRegionId_" + i)));
      address.setStreet(jsonObject.optString("Faddrstreet_" + i));
      address.setZipcode(Result.toString(jsonObject.opt("Fzipcode_" + i)));
      address.setMobile(Result.toString(jsonObject.opt("Fmobile_" + i)));
      address.setTel(Result.toString(jsonObject.opt("Ftel_" + i)));
      address.setName(Result.toString(jsonObject.opt("Fname_" + i)));
      address.setCreated(Result.parseDate(jsonObject.opt("Fcreate_time_" + i),
          "yyyy-MM-dd HH:mm:ss", Locale.CHINA));
View Full Code Here

      address.setTotal(total);
      address.setIndex(index);
      address.setRegionId(Result.parseInteger(jsonObject.opt("FRegionId_" + i)));
      address.setStreet(jsonObject.optString("Faddrstreet_" + i));
      address.setZipcode(Result.toString(jsonObject.opt("Fzipcode_" + i)));
      address.setMobile(Result.toString(jsonObject.opt("Fmobile_" + i)));
      address.setTel(Result.toString(jsonObject.opt("Ftel_" + i)));
      address.setName(Result.toString(jsonObject.opt("Fname_" + i)));
      address.setCreated(Result.parseDate(jsonObject.opt("Fcreate_time_" + i),
          "yyyy-MM-dd HH:mm:ss", Locale.CHINA));
      address.setModified(Result.parseDate(jsonObject.opt("Fmod_time_" + i), "yyyy-MM-dd HH:mm:ss",
View Full Code Here

      address.setIndex(index);
      address.setRegionId(Result.parseInteger(jsonObject.opt("FRegionId_" + i)));
      address.setStreet(jsonObject.optString("Faddrstreet_" + i));
      address.setZipcode(Result.toString(jsonObject.opt("Fzipcode_" + i)));
      address.setMobile(Result.toString(jsonObject.opt("Fmobile_" + i)));
      address.setTel(Result.toString(jsonObject.opt("Ftel_" + i)));
      address.setName(Result.toString(jsonObject.opt("Fname_" + i)));
      address.setCreated(Result.parseDate(jsonObject.opt("Fcreate_time_" + i),
          "yyyy-MM-dd HH:mm:ss", Locale.CHINA));
      address.setModified(Result.parseDate(jsonObject.opt("Fmod_time_" + i), "yyyy-MM-dd HH:mm:ss",
          Locale.CHINA));
View Full Code Here

      address.setRegionId(Result.parseInteger(jsonObject.opt("FRegionId_" + i)));
      address.setStreet(jsonObject.optString("Faddrstreet_" + i));
      address.setZipcode(Result.toString(jsonObject.opt("Fzipcode_" + i)));
      address.setMobile(Result.toString(jsonObject.opt("Fmobile_" + i)));
      address.setTel(Result.toString(jsonObject.opt("Ftel_" + i)));
      address.setName(Result.toString(jsonObject.opt("Fname_" + i)));
      address.setCreated(Result.parseDate(jsonObject.opt("Fcreate_time_" + i),
          "yyyy-MM-dd HH:mm:ss", Locale.CHINA));
      address.setModified(Result.parseDate(jsonObject.opt("Fmod_time_" + i), "yyyy-MM-dd HH:mm:ss",
          Locale.CHINA));
      address.setLastUsed(Result.parseDate(jsonObject.opt("Flastuse_time_" + i),
View Full Code Here

      address.setStreet(jsonObject.optString("Faddrstreet_" + i));
      address.setZipcode(Result.toString(jsonObject.opt("Fzipcode_" + i)));
      address.setMobile(Result.toString(jsonObject.opt("Fmobile_" + i)));
      address.setTel(Result.toString(jsonObject.opt("Ftel_" + i)));
      address.setName(Result.toString(jsonObject.opt("Fname_" + i)));
      address.setCreated(Result.parseDate(jsonObject.opt("Fcreate_time_" + i),
          "yyyy-MM-dd HH:mm:ss", Locale.CHINA));
      address.setModified(Result.parseDate(jsonObject.opt("Fmod_time_" + i), "yyyy-MM-dd HH:mm:ss",
          Locale.CHINA));
      address.setLastUsed(Result.parseDate(jsonObject.opt("Flastuse_time_" + i),
          "yyyy-MM-dd HH:mm:ss", Locale.CHINA));
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.