0

I have a java-script object (com.google.gwt.core.client.JavaScriptObject). I need to convert the data in this object into a JSONObject (com.google.gwt.json.client.JSONObject). How can I do this?.

I have tried this:

JavaScriptObject object=getData();

String json=stringfy((JsArray) object);  //done using native JSNI method

JSONValue jsonValue=null;

jsonValue=JSONParser.parseStrict(json);

JSONObject  msg=jsonValue.isObject();

The problem here is that I need to serialize and make a json string out of my data which is an overhead. Is there any other method to do this ?

1 Answer 1

2
JavaScriptObject object = getData();
JSONObject msg = new JSONObject(object);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.