Logo Search packages:      
Sourcecode: libjson-java version File versions

JSONObject net::sf::json::JSONArray::toJSONObject ( JSONArray  names  )  [inline]

Produce a JSONObject by combining a JSONArray of names with the values of this JSONArray.

names A JSONArray containing a list of key strings. These will be paired with the values.
A JSONObject, or null if there are no names or if this JSONArray has no values.
JSONException If any of the names are null.

Definition at line 2362 of file JSONArray.java.

References net::sf::json::JSONObject::element(), getString(), opt(), and size().

      if( names == null || names.size() == 0 || size() == 0 ){
         return null;
      JSONObject jo = new JSONObject();
      for( int i = 0; i < names.size(); i++ ){
         jo.element( names.getString( i ), this.opt( i ) );
      return jo;

Generated by  Doxygen 1.6.0   Back to index