Exemple #1
0
 /// <summary>
 /// Produce a JSONObject by combining a JSONArray of names with the values
 /// of this JSONArray.
 /// </summary>
 /// <param name="names">
 /// A JSONArray containing a list of key strings. These will be paired with the values.
 /// </param>
 /// <returns>A JSONObject, or null if there are no names or if this JSONArray</returns>
 public JSONObject toJSONObject(JSONArray names)
 {
     if (names == null || names.Length() == 0 || this.Length() == 0)
     {
         return null;
     }
     JSONObject jo = new JSONObject();
     for (int i=0; i <names.Length(); i++)
     {
         jo.put(names.getString(i),this.opt(i));
     }
     return jo;
 }