private Map < String , Object > convertObject ( V8Object obj ) { if ( obj . isUndefined ( ) ) { return null ; } Map < String , Object > r = new LinkedHashMap <> ( ) ; for ( String k : obj . getKeys ( ) ) { Object o = obj . get ( k ) ; if ( o instanceof V8Array ) { o = convert ( ( V8Array ) o , List . class ) ; } else if ( o instanceof V8Object ) { o = convert ( ( V8Object ) o , Map . class ) ; } r . put ( k , o ) ; } return r ; }
Recursively convert a V8 object to a map and release it