code: public static JSONObject fromObject( Object object, JsonConfig jsonConfig ) {
        if( object == null || JSONUtils.isNull( object ) ){
           return new JSONObject( true );
        }else if( object instanceof Enum ){
           throw new JSONException( "'object' is an Enum. Use JSONArray instead" );
        }else if( object instanceof Annotation || (object != null && object.getClass()
              .isAnnotation()) ){
           throw new JSONException( "'object' is an Annotation." );
        }else if( object instanceof JSONObject ){
           return _fromJSONObject( (JSONObject) object, jsonConfig );
        }else if( object instanceof DynaBean ){
           return _fromDynaBean( (DynaBean) object, jsonConfig );
        }else if( object instanceof JSONTokener ){
           return _fromJSONTokener( (JSONTokener) object, jsonConfig );
        }else if( object instanceof JSONString ){
           return _fromJSONString( (JSONString) object, jsonConfig );
        }else if( object instanceof Map ){
           return _fromMap( (Map) object, jsonConfig );
        }else if( object instanceof String ){
           return _fromString( (String) object, jsonConfig );
        }else if( JSONUtils.isNumber( object ) || JSONUtils.isBoolean( object )
              || JSONUtils.isString( object ) ){
           return new JSONObject();
        }else if( JSONUtils.isArray( object ) ){
           throw new JSONException( "'object' is an array. Use JSONArray instead" );
        }else{
           return _fromBean( object, jsonConfig );
        }
     }
docs: Creates a JSONObject.<br>
  Inspects the object type to call the correct JSONObject factory method.
  Accepts JSON formatted strings, Maps, DynaBeans and JavaBeans.
  
  @param object
  @throws JSONException if the object can not be converted to a proper
  JSONObject.