Package net.sf.json

Examples of net.sf.json.JSONObject.keys()


    Iterator it = jsonArray.iterator();
    while (it.hasNext()) {
      JSONObject jsonObject = (JSONObject) it.next();

      Iterator keys = jsonObject.keys();
      while (keys.hasNext()) {
        Object key = keys.next();
        Object value = jsonObject.get(key);
        arrayList.add(value);
      }
View Full Code Here


   * @return
   */
  public static HashMap toHashMap(Object object) {
    HashMap<String, Object> data = new HashMap<String, Object>();
    JSONObject jsonObject = JSONHelper.toJSONObject(object);
    Iterator it = jsonObject.keys();
    while (it.hasNext()) {
      String key = String.valueOf(it.next());
      Object value = jsonObject.get(key);
      data.put(key, value);
    }
View Full Code Here

    List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
    JSONArray jsonArray = JSONArray.fromObject(object);
    for (Object obj : jsonArray) {
      JSONObject jsonObject = (JSONObject) obj;
      Map<String, Object> map = new HashMap<String, Object>();
      Iterator it = jsonObject.keys();
      while (it.hasNext()) {
        String key = (String) it.next();
        Object value = jsonObject.get(key);
        map.put((String) key, value);
      }
View Full Code Here

    }
    field = dealSyscode(field,1);
    StringBuilder re = new StringBuilder();
    try{
      JSONObject obj = JSONObject.fromObject(field);
      Iterator it = obj.keys();
      while(it.hasNext()){
        String key = String.valueOf(it.next());
        JSONObject nextObj =((JSONObject)obj.get(key));
        Iterator itvalue =nextObj.keys();
        re.append(key+"="+"\"");
View Full Code Here

      JSONObject obj = JSONObject.fromObject(field);
      Iterator it = obj.keys();
      while(it.hasNext()){
        String key = String.valueOf(it.next());
        JSONObject nextObj =((JSONObject)obj.get(key));
        Iterator itvalue =nextObj.keys();
        re.append(key+"="+"\"");
        if(nextObj.size()<=1){
          String onlykey = String.valueOf(itvalue.next());
          if("value".equals(onlykey)){
            re.append(nextObj.get(onlykey)+"");
View Full Code Here

  public void parse(String config) {
    JSONObject o=JSONObject.fromObject(config);
    jobId=o.getString("jobId");
    JSONObject kvc=o.getJSONObject("kvConfig");
    Map<String, String> map=new HashMap<String, String>();
    for(Iterator<Object> it=kvc.keys();it.hasNext();){
      Object key=it.next();
      if(kvc.getString(key.toString())!=null){
        map.put(key.toString(), kvc.getString(key.toString()));
      }
    }
View Full Code Here

     */
    public final ArrayList<UPModel> getModels() throws IOException, UPInvalidParameterException {
        this.setUrl("https://api.uniparthenope.it/meteo/models/getmodels");
        final JSONObject json = this.connect();
        final JSONObject modelsRequested = json.getJSONObject("models");
        final Iterator it = modelsRequested.keys();
        ArrayList<UPModel> UPModels = new ArrayList<>();
        while (it.hasNext()) {
            Object currentKey = it.next();
            UPModels.add(new UPModel(currentKey.toString(),modelsRequested.get(currentKey).toString()));
        }
View Full Code Here

        if (model == null || model.isEmpty()) {
            throw new UPInvalidParameterException("The model can not be a null or an empty string");
        }
        this.setUrl("https://api.uniparthenope.it/meteo/"+model+"/getoutputs");
        final JSONObject requestsOutputs = this.connect().getJSONObject("outputs");
        final Iterator it = requestsOutputs.keys();
        ArrayList<UPOutput> outputs = new ArrayList<>();
        while (it.hasNext()) {
            Object currentKey = it.next();
            outputs.add(new UPOutput(currentKey.toString(),requestsOutputs.get(currentKey).toString()));
        }
View Full Code Here

      }

      if (obj.has("sqlDsIndex")) {
        Map<String, Integer> tempSqlDsIndexMap = new HashMap<String, Integer>();
        JSONObject sqlDsIndex = obj.getJSONObject("sqlDsIndex");
        Iterator it=sqlDsIndex.keys();
        while(it.hasNext()){
          String key=String.valueOf(it.next()).trim();
          Integer index=Integer.valueOf(key);
          JSONArray array=sqlDsIndex.getJSONArray(key);
          for (int i=0;i<array.size();i++) {
View Full Code Here

      }

      if (obj.has("tabDsIndex")) {
        Map<String, Integer> tempTabDsIndexMap = new HashMap<String, Integer>();
        JSONObject sqlDsIndex = obj.getJSONObject("tabDsIndex");
        Iterator it=sqlDsIndex.keys();
        while(it.hasNext()){
          String key=String.valueOf(it.next()).trim();
          Integer index=Integer.valueOf(key);
          JSONArray array=sqlDsIndex.getJSONArray(key);
          for (int i=0;i<array.size();i++) {
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.