if (x instanceof JSONString) {
Object object;
try {
object = ((JSONString)x).toJSONString();
} catch (Exception e) {
throw new JSONException(e);
}
if (object instanceof String) {
return (String)object;
}
throw new JSONException("Bad value from toJSONString: " + object);
}
if (x instanceof Number) {
return JSONObject.numberToString((Number)x);
}
if (x instanceof Boolean || x instanceof JSONObject ||