Sure, use a JSON library written in JS :-)
See: <http://www.JSON.org/js.html>
After incorporating it in your program, just pass JSON.stringify(obj)  
to your Java method.

Attila.

On Jul 4, 2008, at 11:17 PM, DarkIT wrote:

> Hi everybody,
>
> I'm trying to add rhino to our application.
> Everything seams fine except I don't know how can I transform JSON
> object  or JSON Array from Rhino to Java object - String (the most
> easy way) or java JSON Object.
>
> Scenario I want to implement is JavaScript function which is uploaded
> to server and it's executed inside server enviroment. Inside this
> JavaScript function can be many call to Java function with in/out JSON
> objects.
>
> Java function:  public long save(String entity) {...} or  public long
> save(JSONObject entity) {...}
>
> When I call this function from Rhino I've got exception because I have
> nativeObject not String and when I try to invoke "toString()" function
> on it I received just "[object Object]"
>
>
> Is there easy solution how to transform JavaScript JSON object to Java
> String or java JSON object?



_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino

Reply via email to