public static JsonObject toJsonObject(final Object obj) {
        Map<String, Object> m = null;

        if (obj instanceof Map) {
            m = (Map<String, Object>) obj;
        } else if (N.isEntity(obj.getClass())) {
            m = Maps.entity2Map(obj);
        } else if (obj instanceof Object[]) {
            m = N.asProps(obj);
        } else {
            throw new IllegalArgumentException("The parameters must be a Map, or an entity class with getter/setter methods");
        }

        final JsonObject result = JsonObject.create();

        for (Map.Entry<String, Object> entry : m.entrySet()) {
            if (entry.getValue() == null || supportedTypes.contains(entry.getValue().getClass())) {
                result.put(entry.getKey(), entry.getValue());
            } else {
                Type<Object> valueType = N.typeOf(entry.getValue().getClass());

                if (valueType.isMap() || valueType.isEntity()) {
                    result.put(entry.getKey(), toJsonObject(entry.getValue()));
                } else if (valueType.isObjectArray() || valueType.isCollection()) {
                    result.put(entry.getKey(), toJsonArray(entry.getValue()));
                } else {
                    result.put(entry.getKey(), N.stringOf(entry.getValue()));
                }
            }
        }

        return result;
    }
public static JsonObject toJsonObject ( final Object obj ) { Map < String , Object > m = null ; if ( obj instanceof Map ) { m = ( Map < String , Object > ) obj ; } else if ( N . isEntity ( obj . getClass ( ) ) ) { m = Maps . entity2Map ( obj ) ; } else if ( obj instanceof Object [ ] ) { m = N . asProps ( obj ) ; } else { throw new IllegalArgumentException ( "The parameters must be a Map, or an entity class with getter/setter methods" ) ; } final JsonObject result = JsonObject . create ( ) ; for ( Map . Entry < String , Object > entry : m . entrySet ( ) ) { if ( entry . getValue ( ) == null || supportedTypes . contains ( entry . getValue ( ) . getClass ( ) ) ) { result . put ( entry . getKey ( ) , entry . getValue ( ) ) ; } else { Type < Object > valueType = N . typeOf ( entry . getValue ( ) . getClass ( ) ) ; if ( valueType . isMap ( ) || valueType . isEntity ( ) ) { result . put ( entry . getKey ( ) , toJsonObject ( entry . getValue ( ) ) ) ; } else if ( valueType . isObjectArray ( ) || valueType . isCollection ( ) ) { result . put ( entry . getKey ( ) , toJsonArray ( entry . getValue ( ) ) ) ; } else { result . put ( entry . getKey ( ) , N . stringOf ( entry . getValue ( ) ) ) ; } } } return result ; }
@param obj an array of pairs of property name and value, or Map<String, Object>, or an entity with getter/setter methods.
@return