Index: applications/editors/josm/plugins/geochat/build.xml
===================================================================
--- applications/editors/josm/plugins/geochat/build.xml	(revision 30233)
+++ applications/editors/josm/plugins/geochat/build.xml	(revision 30234)
@@ -5,5 +5,5 @@
     <property name="commit.message" value="[josm_geochat] copypaste from keyboard, font size advanced parameters"/>
     <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
-    <property name="plugin.main.version" value="6484"/>
+    <property name="plugin.main.version" value="6756"/>
 
     <property name="plugin.author" value="Ilya Zverev"/>
Index: applications/editors/josm/plugins/geochat/src/geochat/ChatServerConnection.java
===================================================================
--- applications/editors/josm/plugins/geochat/src/geochat/ChatServerConnection.java	(revision 30233)
+++ applications/editors/josm/plugins/geochat/src/geochat/ChatServerConnection.java	(revision 30234)
@@ -15,7 +15,8 @@
 import java.util.Set;
 
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
+import javax.json.JsonArray;
+import javax.json.JsonException;
+import javax.json.JsonObject;
+
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.data.coor.CoordinateFormat;
@@ -92,6 +93,6 @@
             String query = "whoami&uid=" + uid;
             JsonQueryUtil.queryAsync(query, new JsonQueryCallback() {
-                public void processJson( JSONObject json ) {
-                    if( json != null && json.has("name") )
+                public void processJson( JsonObject json ) {
+                    if( json != null && json.get("name") != null )
                         login(uid, json.getString("name"));
                     else if( userName != null && userName.length() > 1 )
@@ -143,13 +144,13 @@
                     + nameAttr;
             JsonQueryUtil.queryAsync(query, new JsonQueryCallback() {
-                public void processJson( JSONObject json ) {
+                public void processJson( JsonObject json ) {
                     if( json == null )
                         fireLoginFailed(tr("Could not get server response, check logs"));
-                    else if( json.has("error") )
+                    else if( json.get("error") != null )
                         fireLoginFailed(tr("Failed to login as {0}:", userName) + "\n" + json.getString("error"));
-                    else if( !json.has("uid") )
+                    else if( json.get("uid") == null)
                         fireLoginFailed(tr("The server did not return user ID"));
                     else {
-                        String name = json.has("name") ? json.getString("name") : userName;
+                        String name = json.get("name") != null ? json.getString("name") : userName;
                         login(json.getInt("uid"), name);
                     }
@@ -190,6 +191,6 @@
         String query = "logout&uid=" + userId;
         JsonQueryUtil.queryAsync(query, new JsonQueryCallback() {
-            public void processJson( JSONObject json ) {
-                if( json != null && json.has("message") ) {
+            public void processJson( JsonObject json ) {
+                if( json != null && json.get("message") != null) {
                     logoutIntl();
                 }
@@ -245,8 +246,8 @@
                     query += "&to=" + URLEncoder.encode(targetUser, "UTF8");
             JsonQueryUtil.queryAsync(query, new JsonQueryCallback() {
-                public void processJson( JSONObject json ) {
+                public void processJson( JsonObject json ) {
                     if( json == null )
                         fireMessageFailed(tr("Could not get server response, check logs"));
-                    else if( json.has("error") )
+                    else if( json.get("error") != null )
                         fireMessageFailed(tr("Failed to send message:") + "\n" + json.getString("error"));
                 }
@@ -356,5 +357,5 @@
                     + "&lon=" + pos.lonToString(CoordinateFormat.DECIMAL_DEGREES)
                     + "&uid=" + userId + "&last=" + lastId;
-            JSONObject json;
+            JsonObject json;
             try {
                 json = JsonQueryUtil.query(query);
@@ -366,15 +367,15 @@
 //              fireLoginFailed(tr("Could not get server response, check logs"));
 //              logoutIntl(); // todo: uncomment?
-            } else if( json.has("error") ) {
+            } else if( json.get("error") != null) {
                 fireLoginFailed(tr("Failed to get messages as {0}:", userName) + "\n" + json.getString("error"));
                 logoutIntl();
             } else {
-                if( json.has("users") ) {
-                    Map<String, LatLon> users = parseUsers(json.getJSONArray("users"));
+                if( json.get("users") != null) {
+                    Map<String, LatLon> users = parseUsers(json.getJsonArray("users"));
                     for( ChatServerConnectionListener listener : listeners )
                         listener.updateUsers(users);
                 }
-                if( json.has("messages") ) {
-                    List<ChatMessage> messages = parseMessages(json.getJSONArray("messages"), false);
+                if( json.get("messages") != null) {
+                    List<ChatMessage> messages = parseMessages(json.getJsonArray("messages"), false);
                     for( ChatMessage m : messages )
                         if( m.getId() > lastId )
@@ -383,6 +384,6 @@
                         listener.receivedMessages(needReset, messages);
                 }
-                if( json.has("private") ) {
-                    List<ChatMessage> messages = parseMessages(json.getJSONArray("private"), true);
+                if( json.get("private") != null) {
+                    List<ChatMessage> messages = parseMessages(json.getJsonArray("private"), true);
                     for( ChatMessage m : messages )
                         if( m.getId() > lastId )
@@ -396,13 +397,13 @@
         }
 
-        private List<ChatMessage> parseMessages( JSONArray messages, boolean priv ) {
+        private List<ChatMessage> parseMessages( JsonArray messages, boolean priv ) {
             List<ChatMessage> result = new ArrayList<ChatMessage>();
-            for( int i = 0; i < messages.length(); i++ ) {
+            for( int i = 0; i < messages.size(); i++ ) {
                 try {
-                    JSONObject msg = messages.getJSONObject(i);
-                    long id = msg.getLong("id");
-                    double lat = msg.getDouble("lat");
-                    double lon = msg.getDouble("lon");
-                    long timeStamp = msg.getLong("timestamp");
+                	JsonObject msg = messages.getJsonObject(i);
+                    long id = msg.getJsonNumber("id").longValue();
+                    double lat = msg.getJsonNumber("lat").doubleValue();
+                    double lon = msg.getJsonNumber("lon").doubleValue();
+                    long timeStamp = msg.getJsonNumber("timestamp").longValue();
                     String author = msg.getString("author");
                     String message = msg.getString("message");
@@ -411,8 +412,8 @@
                             incoming, message, new Date(timeStamp * 1000));
                     cm.setPrivate(priv);
-                    if( msg.has("recipient") && !incoming )
+                    if( msg.get("recipient") != null && !incoming )
                         cm.setRecipient(msg.getString("recipient"));
                     result.add(cm);
-                } catch( JSONException e ) {
+                } catch( JsonException e ) {
                     // do nothing, just skip this message
                 }
@@ -421,14 +422,14 @@
         }
 
-        private Map<String, LatLon> parseUsers( JSONArray users ) {
+        private Map<String, LatLon> parseUsers( JsonArray users ) {
             Map<String, LatLon> result = new HashMap<String, LatLon>();
-            for( int i = 0; i < users.length(); i++ ) {
+            for( int i = 0; i < users.size(); i++ ) {
                 try {
-                    JSONObject user = users.getJSONObject(i);
+                	JsonObject user = users.getJsonObject(i);
                     String name = user.getString("user");
-                    double lat = user.getDouble("lat");
-                    double lon = user.getDouble("lon");
+                    double lat = user.getJsonNumber("lat").doubleValue();
+                    double lon = user.getJsonNumber("lon").doubleValue();
                     result.put(name, new LatLon(lat, lon));
-                } catch( JSONException e ) {
+                } catch( JsonException e ) {
                     // do nothing, just skip this user
                 }
Index: applications/editors/josm/plugins/geochat/src/geochat/JsonQueryCallback.java
===================================================================
--- applications/editors/josm/plugins/geochat/src/geochat/JsonQueryCallback.java	(revision 30233)
+++ applications/editors/josm/plugins/geochat/src/geochat/JsonQueryCallback.java	(revision 30234)
@@ -2,5 +2,5 @@
 package geochat;
 
-import org.json.JSONObject;
+import javax.json.JsonObject;
 
 /**
@@ -17,4 +17,4 @@
      * @param json JSON parsed response or null if the query was unsuccessful.
      */
-    void processJson( JSONObject json );
+    void processJson( JsonObject json );
 }
Index: applications/editors/josm/plugins/geochat/src/geochat/JsonQueryUtil.java
===================================================================
--- applications/editors/josm/plugins/geochat/src/geochat/JsonQueryUtil.java	(revision 30233)
+++ applications/editors/josm/plugins/geochat/src/geochat/JsonQueryUtil.java	(revision 30234)
@@ -8,7 +8,9 @@
 import java.net.MalformedURLException;
 import java.net.URL;
-import org.json.JSONException;
-import org.json.JSONObject;
-import org.json.JSONTokener;
+
+import javax.json.Json;
+import javax.json.JsonException;
+import javax.json.JsonObject;
+
 import org.openstreetmap.josm.Main;
 
@@ -23,8 +25,8 @@
      * Query the server synchronously.
      * @param query Query string, starting with action. Example: <tt>get&lat=1.0&lon=-2.0&uid=12345</tt>
-     * @return Parsed JSONObject if the query was successful, <tt>null</tt> otherwise.
+     * @return Parsed JsonObject if the query was successful, <tt>null</tt> otherwise.
      * @throws IOException There was a problem connecting to the server or parsing JSON.
      */
-    public static JSONObject query( String query ) throws IOException {
+    public static JsonObject query( String query ) throws IOException {
         try {
             String serverURL = Main.pref.get("geochat.server", "http://zverik.dev.openstreetmap.org/osmochat.php?action=");
@@ -40,8 +42,6 @@
                 throw new IOException("Empty response");
             try {
-                JSONTokener tokener = new JSONTokener(inp);
-                JSONObject result = new JSONObject(tokener);
-                return result;
-            } catch( JSONException e ) {
+                return Json.createReader(inp).readObject();
+            } catch( JsonException e ) {
                 throw new IOException("Failed to parse JSON: " + e.getMessage());
             } finally {
@@ -75,5 +75,5 @@
 
     private void doRealRun() {
-        JSONObject obj;
+    	JsonObject obj;
         try {
             obj = query(query);
