GWT object parameter from javascript to java (JavaScriptObject to JSONObject)
Asked Answered
S

2

6

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

Smelter answered 27/2, 2014 at 17:42 Comment(0)
L
7

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

Lorola answered 27/2, 2014 at 19:10 Comment(1)
Your solution sounds much more professional and correct!Martino
M
1

I had same problem week ago and I have not found answer to that question. I simply encoded object as string and passed it to Java

Martino answered 27/2, 2014 at 18:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.