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

JSONArray net::sf::json::JSONArray::element ( String  value,
JsonConfig  jsonConfig 
) [inline]

Append a String value. This increases the array's length by one.
The string may be a valid JSON formatted string, in tha case, it will be trabsformed to a JSONArray, JSONObjetc or JSONNull.

Parameters:
value A String value.
Returns:
this.

Definition at line 1774 of file JSONArray.java.

References elements.

                                                                   {
      if( value == null ){
         this.elements.add( "" );
      }else if( JSONUtils.mayBeJSON( value ) ){
         try{
            this.elements.add( JSONSerializer.toJSON( value, jsonConfig ) );
         }catch( JSONException jsone ){
            this.elements.add( JSONUtils.stripQuotes( value ) );
         }
      }else{
         this.elements.add( JSONUtils.stripQuotes( value ) );
      }
      return this;
   }


Generated by  Doxygen 1.6.0   Back to index