fix for org.json.JSONObject writing (both in Java and JavaScript)