That is a bug -- thanks for finding it. You can work around it by
calling the alternative toString() routine below. Just put this static
function in a class (e.g. JSONPatch), and replace
xxxx.yyyy.zzzz.JSONPatch with the package name you've chosen.
The bug has already been fixed and will be included in the next GWT
release.
Thanks again,
Henry
/**
* Converts a JSONObject into a JSON representation that can be used
to
* communicate with a JSON service.
*
* @return a JSON string representation of this JSONObject instance
*/
public static native String toStringJSONObject(JSONObject obj) /*-{
for(var x in
th...@com.google.gwt.json.client.JSONObject::backStore) {
// we are wrapping everything in backStore so that frontStore is
canonical
th...@com.google.gwt.json.client.JSONObject::get(Ljava/lang/String;)(x
);
}
var out = [];
out.push("{");
var first = true;
for(var x in o...@com.google.gwt.json.client.JSONObject::frontStore
) {
if(first) {
first = false;
} else {
out.push(", ");
}
var subItem =
(o...@com.google.gwt.json.client.JSONObject::frontStore[x ]);
var subObj=null;
if(!(subIt...@com.google.gwt.json.client.JSONValue::isObject()())) {
subObj =
(subItem)....@com.google.gwt.json.client.JSONValue::toString ()();
} else {
subObj =
@xxxx.yyyy.zzzz.JSONPatch::toStringJSONObject(Lcom/google/gwt/json/client/J SONObject;)(subItem);
}
out.push("\"");
out.push (x);
out.push("\":");
out.push(subObj);
}
out.push("}")
return out.join("");
}-*/;