Search code examples
javascriptgwtcallbackjsni

GWT object parameter from javascript to java (JavaScriptObject to JSONObject)


I have Object that I wish to pass from JavaScript to Java in GWT app.

This object may have arbitary fields. So it is different from very similar question were only number is passed. Passing javascript parameter from external javascript to java

I define callback like

public static void cbSysInfoSucces(JavaScriptObject o1) {
}

But I do not know how to convert JavaScriptObject to JSONObject

Could you also advice on $entry() function format if I wish to pass Object to java


Solution

  • Use constructor JSONObject(JavaScriptObject jsValue) to create a new JSONObject from the supplied JavaScript value.