On 17 sep, 13:51, JaM <[email protected]> wrote:
> I have but that works only for receiving information from "the wild",
> or JSNI, right?
>
> My case is I am starting in Java, I want to send a JSON object to an
> external Javascript function, so I don't think this will fit the bill,
> unless I have misinterpreted the docs.

JSONObject obj = ...;
aJsniMethodToGoFromJavaToJs(obj.getJavaScriptObject());
obj = new JSONObject(aJsniMethodToGoFromJsToJava());

with:
native void aJsniMethodToGoFromJavaToJs(JavaScriptObject obj) /*-{
   $wnd.doSomethingWithThis(obj);
   // here, you can use obj.property or obj["property"] for instance
}-*/;
native JavaScriptObject aJsniMethodToGoFromJsToJava() /*{
   return { "number": 3.14, "string": "something", "array": [ 1,
"two", 3 ] };
}-*/;

...but I think what Ben actually was suggesting is that you don't use
com.google.gwt.json.JSON any more and replace your JSONValue's
(JSONObject, JSONArray, JSONNumber, etc.) with JSO overlays.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to