It's grateful that you provide so excellent J2V8 framework, I'm embedding it for my project, My project is now using Rhino engine. I'm facing one problem. I found there's no javaToJS or jsToJava api in J2V8, but Rhino has this api. In our project, we use javaToJS to convert java object to javascript object directly, it's necessary and convenient api for us. Therefore, would you do us favor to tell us how to convert java object to javascript in J2V8, or javascript to java.
Is there javaToJS/jsToJava api similar to Rhino in J2V8?
401 views Asked by supersamurai At
1
In our project we have same goal of migration from
Rhino
toV8
. I have found, that for conversion of V8 objects to Java objectsV8ObjectUtils.getValue()
could be used. Also TypeAdapter could be used optionally to provide custom transformation rules if needed.Unfortunatly V8 does not provide ability to convert Java objects to V8 object. But I have found nice project, which does it - v8-adapter
Also I have added some behaviour to the project, which is similar to Rhino - e.g. read V8 objects as Java maps or V8 arrays as Java lists in Java host objects. As well as some other enhancements. Thus your migration should be easier now. The v8-adapter project is developed actively - feel free to contribute if something is needed.