Package org.json

Examples of org.json.JSONArray.optString()


          arColors.add(color);
      }
      JSONArray jcategory = jhit.optJSONArray("category");
      if (jcategory != null)
      {
        String category = jcategory.optString(0);
        if (category != null)
        {
          arCategories.add(category);
        }
      }
View Full Code Here


    ArrayList<String> arCategories = new ArrayList<String>();
    for(int i=0; i<jhits.length(); i++){
      JSONObject jhit = jhits.getJSONObject(i);
      JSONArray jcolor = jhit.optJSONArray("color");
      if(jcolor != null){
        String color = jcolor.optString(0);
        if(color != null)
          arColors.add(color);
      }
      JSONArray jcategory = jhit.optJSONArray("category");
      if (jcategory != null)
View Full Code Here

          arColors.add(color);
      }
      JSONArray jcategory = jhit.optJSONArray("category");
      if (jcategory != null)
      {
        String category = jcategory.optString(0);
        if (category != null)
        {
          arCategories.add(category);
        }
      }
View Full Code Here

    // Process the function body and parameters firstly

    JSONArray jsonFuncParameter = jsonModel.optJSONArray(RelevanceJSONConstants.KW_FUNC_PARAMETERS);
    for(int j=0; j<jsonFuncParameter.length(); j++)
    {
      String paramName = jsonFuncParameter.optString(j);
      dataTable.lls_params.add(paramName);
    }

    dataTable.funcBody = jsonModel.optString(RelevanceJSONConstants.KW_FUNCTION);
View Full Code Here

        JSONArray fieldsArray = jsonQuery.optJSONArray(FIELDS_PARAM);
        if (fieldsArray != null)
        {
          for (int i=0; i<fieldsArray.length(); ++i)
          {
            String field = fieldsArray.optString(i, null);
            if (field != null && field.length() != 0)
              fields.add(field);
          }
        }
View Full Code Here

      JSONArray array = obj.optJSONArray(field);
      if (array!=null){
      int count = array.length();
      strArray = new String[count];
      for (int i=0;i<count;++i){
        strArray[i] = array.optString(i);
      }
      }
      return strArray;
    }
View Full Code Here

      this.name = name;
      this.type = type;
      this.repeating = true;
      this.multivalues = new ArrayList<String>(ja.length());
      for (int i = 0; i < ja.length(); i++) {
        this.multivalues.add(ja.optString(i));
      }
    } else {
      throw new IllegalArgumentException(
          "Can't make a property from this json object");
    }
View Full Code Here

      return new ArrayList<String>(0);
    }
   
    List<String> roles = new ArrayList<String>( rolesArr.length() );
    for(int i=0,e=rolesArr.length(); i<e; ++i){
      String role = rolesArr.optString(i);
      if( null != role ) {
        roles.add( role );
      }
    }
    return roles;
View Full Code Here

    Set<String> roles = new HashSet<String>();
   
    JSONArray roleArray = json.optJSONArray("roles");
    if( null != roleArray ){
      for(int i=0,e=roleArray.length(); i<e; ++i){
        String role = roleArray.optString(i);
        if( null != role ){
          roles.add(role);
        }
      }
    }
View Full Code Here

    Set<String> emails = new HashSet<String>();
   
    JSONArray emailArray = json.optJSONArray(PROP_NAME_EMAILS);
    if( null != emailArray ){
      for(int i=0,e=emailArray.length(); i<e; ++i){
        String email = emailArray.optString(i);
        if( null != email ){
          emails.add(email);
        }
      }
    }
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.