From d8440746c1b6fc9477a843d69c0c6e844a7a5faf Mon Sep 17 00:00:00 2001
From: iroqueta <iroqueta@genexus.com>
Date: Wed, 22 May 2024 16:21:37 -0300
Subject: [PATCH 01/24] Remove org.json lib fork and use new version of the API
 https://github.com/stleary/JSON-java Issue: 105607

---
 .../bc/PendingEventHelper.java                |    2 +-
 .../ISynchronizationHelper.java               |    2 +-
 android/src/main/java/com/genexus/GXutil.java |    2 +-
 .../db/driver/ExternalProviderMetadata.java   |    4 +-
 .../com/genexus/internet/HttpAjaxContext.java |    9 +-
 .../com/genexus/internet/HttpContext.java     |    9 +-
 .../com/genexus/specific/android/Connect.java |   29 +-
 common/pom.xml                                |    5 +
 .../src/main/java/com/genexus/CommonUtil.java |    2 +-
 .../java/com/genexus/GXBaseCollection.java    |   13 +-
 .../java/com/genexus/GXSimpleCollection.java  |   11 +-
 .../genexus/common/interfaces/IGXWebGrid.java |    2 +-
 .../com/genexus/internet/GXHttpClient.java    |    6 +-
 .../com/genexus/internet/GXJSONObject.java    |    4 +-
 .../genexus/internet/GXNavigationHelper.java  |    2 +-
 .../com/genexus/internet/IGxJSONAble.java     |    4 +-
 .../main/java/com/genexus/internet/Msg.java   |    7 +-
 .../java/com/genexus/internet/MsgList.java    |    4 +-
 .../genexus/internet/StringCollection.java    |    4 +-
 .../java/com/genexus/util/GXGeolocation.java  |    4 +-
 .../java/com/genexus/util/GXProperties.java   |    9 +-
 .../main/java/com/genexus/util/IniFile.java   |    4 +-
 .../main/java/com/genexus/util/ThemeData.java |    8 +-
 .../java/com/genexus/util/ThemeHelper.java    |    2 -
 .../com/genexus/xml/GXXMLSerializable.java    |   27 +-
 common/src/main/java/json/org/json/CDL.java   |  261 ----
 .../src/main/java/json/org/json/Cookie.java   |  169 ---
 .../main/java/json/org/json/CookieList.java   |   90 --
 common/src/main/java/json/org/json/HTTP.java  |  163 ---
 .../main/java/json/org/json/HTTPTokener.java  |   77 -
 .../json/org/json/IExtensionJSONObject.java   |    6 -
 .../java/json/org/json/IJsonFormattable.java  |    5 -
 .../main/java/json/org/json/JSONArray.java    |  890 ------------
 .../java/json/org/json/JSONException.java     |   27 -
 .../main/java/json/org/json/JSONObject.java   | 1279 -----------------
 .../main/java/json/org/json/JSONString.java   |   18 -
 .../main/java/json/org/json/JSONStringer.java |   78 -
 .../main/java/json/org/json/JSONTokener.java  |  460 ------
 .../main/java/json/org/json/JSONWriter.java   |  318 ----
 common/src/main/java/json/org/json/Test.java  |  413 ------
 common/src/main/java/json/org/json/XML.java   |  401 ------
 .../main/java/json/org/json/XMLTokener.java   |  292 ----
 .../aws/handler/LambdaEventBridgeHandler.java |    4 +-
 .../db/driver/ExternalProviderMetadata.java   |   10 +-
 .../genexus/db/cosmosdb/CosmosDBHelper.java   |   10 +-
 .../cosmosdb/CosmosDBPreparedStatement.java   |   14 +-
 .../genexus/db/dynamodb/DynamoDBHelper.java   |    6 +-
 gxgeospatial/pom.xml                          |    5 -
 .../main/java/com/genexus/GXGeospatial.java   |    4 +-
 .../main/java/com/genexus/gxmaps/GXMaps.java  |    5 -
 .../java/com/genexus/gxmaps/LocationInfo.java |   11 +-
 .../com/genexus/search/SearchResultItem.java  |   15 +-
 .../springboot/GxSpringBootRestService.java   |    8 +-
 .../com/genexus/internet/HttpAjaxContext.java |   69 +-
 .../com/genexus/security/web/SecureToken.java |    4 +-
 .../security/web/SecureTokenHelper.java       |    4 +-
 .../genexus/security/web/WebSecureToken.java  |   13 +-
 .../webpanels/DynAjaxEventContext.java        |    2 +-
 .../com/genexus/webpanels/GXWebColumn.java    |   13 +-
 .../java/com/genexus/webpanels/GXWebGrid.java |   13 +-
 .../com/genexus/webpanels/GXWebPanel.java     |   34 +-
 .../java/com/genexus/webpanels/GXWebRow.java  |   23 +-
 .../java/com/genexus/webpanels/GXWindow.java  |    5 +-
 .../com/genexus/webpanels/HTMLChoice.java     |   13 +-
 .../com/genexus/webpanels/HTMLObject.java     |   11 +-
 java/src/main/java/com/genexus/GXutil.java    |    2 +-
 .../main/java/com/genexus/GxRestService.java  |   10 +-
 .../src/main/java/com/genexus/GxUserType.java |    6 +-
 .../com/genexus/filters/APIObjectFilter.java  |    4 +-
 .../com/genexus/internet/GXRestAPIClient.java |   15 +-
 .../com/genexus/internet/HttpContext.java     |   13 +-
 .../com/genexus/internet/HttpContextNull.java |    4 +-
 .../websocket/GXWebSocketService.java         |    6 +-
 .../com/genexus/sap/EnterpriseConnect.java    |   18 +-
 .../com/genexus/specific/java/Connect.java    |   29 +-
 .../com/genexus/specific/java/GXutil.java     |    6 +-
 .../com/genexus/webpanels/GXMultiCall.java    |    2 +-
 .../genexus/webpanels/GXOAuthAccessToken.java |   16 +-
 .../com/genexus/webpanels/GXOAuthLogout.java  |    4 +-
 .../webpanels/GXObjectUploadServices.java     |   10 +-
 .../com/genexus/webpanels/HttpContextWeb.java |   12 +-
 .../java/com/genexus/webpanels/HttpUtils.java |    6 +-
 .../main/java/com/genexus/WrapperUtils.java   |    8 +-
 83 files changed, 288 insertions(+), 5301 deletions(-)
 delete mode 100644 common/src/main/java/json/org/json/CDL.java
 delete mode 100644 common/src/main/java/json/org/json/Cookie.java
 delete mode 100644 common/src/main/java/json/org/json/CookieList.java
 delete mode 100644 common/src/main/java/json/org/json/HTTP.java
 delete mode 100644 common/src/main/java/json/org/json/HTTPTokener.java
 delete mode 100644 common/src/main/java/json/org/json/IExtensionJSONObject.java
 delete mode 100644 common/src/main/java/json/org/json/IJsonFormattable.java
 delete mode 100644 common/src/main/java/json/org/json/JSONArray.java
 delete mode 100644 common/src/main/java/json/org/json/JSONException.java
 delete mode 100644 common/src/main/java/json/org/json/JSONObject.java
 delete mode 100644 common/src/main/java/json/org/json/JSONString.java
 delete mode 100644 common/src/main/java/json/org/json/JSONStringer.java
 delete mode 100644 common/src/main/java/json/org/json/JSONTokener.java
 delete mode 100644 common/src/main/java/json/org/json/JSONWriter.java
 delete mode 100644 common/src/main/java/json/org/json/Test.java
 delete mode 100644 common/src/main/java/json/org/json/XML.java
 delete mode 100644 common/src/main/java/json/org/json/XMLTokener.java

diff --git a/android/src/main/java/com/artech/base/synchronization/bc/PendingEventHelper.java b/android/src/main/java/com/artech/base/synchronization/bc/PendingEventHelper.java
index 8e96cba21..54434379f 100644
--- a/android/src/main/java/com/artech/base/synchronization/bc/PendingEventHelper.java
+++ b/android/src/main/java/com/artech/base/synchronization/bc/PendingEventHelper.java
@@ -9,7 +9,7 @@
 import com.genexus.GxSilentTrnSdt;
 import com.genexus.IGxSilentTrn;
 
-import json.org.json.JSONArray;
+import org.json.JSONArray;
 
 public class PendingEventHelper {
 
diff --git a/android/src/main/java/com/artech/synchronization/ISynchronizationHelper.java b/android/src/main/java/com/artech/synchronization/ISynchronizationHelper.java
index ebf9c4e01..5bdc3e8e7 100644
--- a/android/src/main/java/com/artech/synchronization/ISynchronizationHelper.java
+++ b/android/src/main/java/com/artech/synchronization/ISynchronizationHelper.java
@@ -2,7 +2,7 @@
 
 import java.util.TreeMap;
 
-import json.org.json.JSONArray;
+import org.json.JSONArray;
 
 public interface ISynchronizationHelper {
 
diff --git a/android/src/main/java/com/genexus/GXutil.java b/android/src/main/java/com/genexus/GXutil.java
index 30318b8de..a78f2005d 100644
--- a/android/src/main/java/com/genexus/GXutil.java
+++ b/android/src/main/java/com/genexus/GXutil.java
@@ -21,7 +21,7 @@
 import com.genexus.util.GXThreadLocal;
 import com.genexus.util.IThreadLocal;
 
-import json.org.json.JSONObject;
+import org.json.JSONObject;
 
 public final class GXutil
 {
diff --git a/android/src/main/java/com/genexus/db/driver/ExternalProviderMetadata.java b/android/src/main/java/com/genexus/db/driver/ExternalProviderMetadata.java
index 1c77ef85e..3a6e58239 100644
--- a/android/src/main/java/com/genexus/db/driver/ExternalProviderMetadata.java
+++ b/android/src/main/java/com/genexus/db/driver/ExternalProviderMetadata.java
@@ -1,7 +1,7 @@
 package com.genexus.db.driver;
 
-import json.org.json.JSONException;
-import json.org.json.JSONObject;
+import org.json.JSONException;
+import org.json.JSONObject;
 
 public class ExternalProviderMetadata
 {
diff --git a/android/src/main/java/com/genexus/internet/HttpAjaxContext.java b/android/src/main/java/com/genexus/internet/HttpAjaxContext.java
index e63df7481..bf7b2675b 100644
--- a/android/src/main/java/com/genexus/internet/HttpAjaxContext.java
+++ b/android/src/main/java/com/genexus/internet/HttpAjaxContext.java
@@ -3,10 +3,9 @@
 import java.util.ArrayList;
 import java.util.Stack;
 
-import json.org.json.IJsonFormattable;
-import json.org.json.JSONArray;
-import json.org.json.JSONException;
-import json.org.json.JSONObject;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
 
 public abstract class HttpAjaxContext
 {
@@ -497,7 +496,7 @@ public Object GetJSONObject()
 			return wrapper;
 		}
 
-		public void FromJSONObject(IJsonFormattable obj)
+		public void FromJSONObject(Object obj)
 		{
 		}
 
diff --git a/android/src/main/java/com/genexus/internet/HttpContext.java b/android/src/main/java/com/genexus/internet/HttpContext.java
index 173aa7857..3080bbf9a 100644
--- a/android/src/main/java/com/genexus/internet/HttpContext.java
+++ b/android/src/main/java/com/genexus/internet/HttpContext.java
@@ -13,10 +13,9 @@
 import com.genexus.util.Codecs;
 import com.genexus.util.Encryption;
 
-import json.org.json.IJsonFormattable;
-import json.org.json.JSONArray;
-import json.org.json.JSONException;
-import json.org.json.JSONObject;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
 
 public abstract class HttpContext extends HttpAjaxContext implements IHttpContext
 {
@@ -613,7 +612,7 @@ public void ajax_req_read_hidden_sdt(String jsonStr, Object SdtObj)
         {
             try
             {
-                IJsonFormattable jsonObj;
+                Object jsonObj;
                 if (jsonStr.startsWith("["))
                     jsonObj = new JSONArray(jsonStr);
                 else
diff --git a/android/src/main/java/com/genexus/specific/android/Connect.java b/android/src/main/java/com/genexus/specific/android/Connect.java
index caf78c0af..e8c8060e8 100644
--- a/android/src/main/java/com/genexus/specific/android/Connect.java
+++ b/android/src/main/java/com/genexus/specific/android/Connect.java
@@ -3,11 +3,9 @@
 import java.util.Date;
 
 import com.genexus.common.interfaces.SpecificImplementation;
-import com.genexus.db.UserInformation;
 
-import json.org.json.IExtensionJSONObject;
-import json.org.json.JSONException;
-import json.org.json.JSONObject;
+import org.json.JSONException;
+import org.json.JSONObject;
 
 public final class Connect {
 
@@ -41,28 +39,5 @@ public static void init()
 		SpecificImplementation.cdowMask = "EEEE";
 		SpecificImplementation.Base64Encode = "8859_1";
 		SpecificImplementation.UseUnicodeCharacterClass = false;
-		JSONObject.extension = new JSONObjectExtension();
-		
 	}
-	
-	 static class JSONObjectExtension implements IExtensionJSONObject {
-
-			@Override
-			public String dateToString(Date d) throws JSONException {
-				if (d == null) {
-			        throw new JSONException("Null pointer");
-			    }
-			    UserInformation ui = (UserInformation) com.genexus.GXObjectHelper.getUserInformation(new com.genexus.ModelContext(com.genexus.ModelContext.getModelContextPackageClass()), -1);
-			    com.genexus.LocalUtil localUtil = ui.getLocalUtil();
-			    String dateString = localUtil.format(d, localUtil.getDateFormat() + " " + localUtil.getTimeFormat());
-			    try
-			    {
-			    	com.genexus.db.DBConnectionManager.getInstance().disconnect(ui.getHandle());
-			    }
-			    catch (Throwable e)
-			    {}
-			    return dateString;
-			}
-			
-		}
 }
diff --git a/common/pom.xml b/common/pom.xml
index 4d259e600..1bf319834 100644
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -50,6 +50,11 @@
             <artifactId>opentelemetry-api</artifactId>
             <version>${io.opentelemetry.version}</version>
         </dependency>
+		<dependency>
+			<groupId>org.json</groupId>
+			<artifactId>json</artifactId>
+			<version>20231013</version>
+		</dependency>        
     </dependencies>
 
 	<build>
diff --git a/common/src/main/java/com/genexus/CommonUtil.java b/common/src/main/java/com/genexus/CommonUtil.java
index c3bec6a30..52443f5f8 100644
--- a/common/src/main/java/com/genexus/CommonUtil.java
+++ b/common/src/main/java/com/genexus/CommonUtil.java
@@ -4,7 +4,7 @@
 import com.genexus.diagnostics.core.LogManager;
 import com.genexus.util.*;
 
-import json.org.json.JSONObject;
+import org.json.JSONObject;
 
 import java.math.BigDecimal;
 import java.io.*;
diff --git a/common/src/main/java/com/genexus/GXBaseCollection.java b/common/src/main/java/com/genexus/GXBaseCollection.java
index 78af2dc48..880faddff 100644
--- a/common/src/main/java/com/genexus/GXBaseCollection.java
+++ b/common/src/main/java/com/genexus/GXBaseCollection.java
@@ -10,9 +10,10 @@
 import com.genexus.xml.GXXMLSerializer;
 import com.genexus.xml.XMLReader;
 import com.genexus.xml.XMLWriter;
+import com.genexus.json.JSONObjectWrapper;
 
-import json.org.json.IJsonFormattable;
-import json.org.json.JSONArray;
+import org.json.JSONArray;
+import org.json.JSONObject;
 
 public class GXBaseCollection<T extends GXXMLSerializable> extends GXSimpleCollection<T> {
 
@@ -223,7 +224,7 @@ public boolean add(T item)
 
 	@Override
 	@SuppressWarnings("unchecked")
-	public void FromJSONObject(IJsonFormattable obj)
+	public void FromJSONObject(Object obj)
 	{
 		this.clear();
 		JSONArray jsonArr = (JSONArray)obj;
@@ -231,7 +232,9 @@ public void FromJSONObject(IJsonFormattable obj)
 		{
 			try
 			{
-				Object jsonObj = jsonArr.get(i);				
+				Object jsonObj = jsonArr.get(i);
+				if (jsonObj instanceof JSONObject)
+					jsonObj = new JSONObjectWrapper((JSONObject)jsonObj);
 				Class[] parTypes = new Class[] {};
 				Object[] arglist = new Object[] {};
 				if (elementsType == null)
@@ -251,7 +254,7 @@ public void FromJSONObject(IJsonFormattable obj)
 
 						Constructor<T> constructor = elementsType.getConstructor(parTypes);
 						currObj = constructor.newInstance(arglist);
-						((IGxJSONAble)currObj).FromJSONObject((IJsonFormattable)jsonObj);
+						((IGxJSONAble)currObj).FromJSONObject(jsonObj);
 					}
 					add((T)currObj);
 				}
diff --git a/common/src/main/java/com/genexus/GXSimpleCollection.java b/common/src/main/java/com/genexus/GXSimpleCollection.java
index 9a6b34883..69c6e4572 100644
--- a/common/src/main/java/com/genexus/GXSimpleCollection.java
+++ b/common/src/main/java/com/genexus/GXSimpleCollection.java
@@ -22,9 +22,8 @@
 
 import com.genexus.xml.XMLWriter;
 
-import json.org.json.IJsonFormattable;
-import json.org.json.JSONArray;
-import json.org.json.JSONException;
+import org.json.JSONArray;
+import org.json.JSONException;
 
 public class GXSimpleCollection<T> extends GXBaseList<T> {
 
@@ -1031,7 +1030,7 @@ public Object GetJSONObject(boolean includeState)
 		tojson(includeState);
 		return jsonArr;
 	}
-	public void FromJSONObject(IJsonFormattable obj)
+	public void FromJSONObject(Object obj)
 	{
 		
 		this.clear();
@@ -1059,7 +1058,7 @@ public void FromJSONObject(IJsonFormattable obj)
 					{
 						Constructor constructor = elementsType.getConstructor(parTypes);
 						currObj = constructor.newInstance(arglist);
-						((IGxJSONAble)currObj).FromJSONObject((IJsonFormattable)jsonObj);
+						((IGxJSONAble)currObj).FromJSONObject(jsonObj);
 					}
 					if (IGxJSONSerializable.class.isAssignableFrom(elementsType))
 					{
@@ -1317,7 +1316,7 @@ public String toStringCollectionClientJsonString()
 			result = result + ",[";
 			GxUnknownObjectCollection tableCollection = (GxUnknownObjectCollection)super.get(i);
 			int tableCollectionSize = tableCollection.size();
-			jsonObj = new json.org.json.JSONArray();
+			jsonObj = new JSONArray();
 			for (int j = 1; j <= tableCollectionSize; j++)
 			{
 				jsonObj.put((StringCollection)tableCollection.item(j));
diff --git a/common/src/main/java/com/genexus/common/interfaces/IGXWebGrid.java b/common/src/main/java/com/genexus/common/interfaces/IGXWebGrid.java
index b7d612c88..014d2f246 100644
--- a/common/src/main/java/com/genexus/common/interfaces/IGXWebGrid.java
+++ b/common/src/main/java/com/genexus/common/interfaces/IGXWebGrid.java
@@ -1,6 +1,6 @@
 package com.genexus.common.interfaces;
 
-import json.org.json.JSONArray;
+import org.json.JSONArray;
 
 public interface IGXWebGrid {
 	Object GetJSONObject();
diff --git a/common/src/main/java/com/genexus/internet/GXHttpClient.java b/common/src/main/java/com/genexus/internet/GXHttpClient.java
index b7dd30b6b..a939b164e 100644
--- a/common/src/main/java/com/genexus/internet/GXHttpClient.java
+++ b/common/src/main/java/com/genexus/internet/GXHttpClient.java
@@ -4,8 +4,8 @@
 import HTTPClient.URI;
 import com.genexus.CommonUtil;
 import com.genexus.common.interfaces.SpecificImplementation;
-import json.org.json.JSONException;
-import json.org.json.JSONObject;
+import org.json.JSONException;
+import com.genexus.json.JSONObjectWrapper;
 import org.w3c.dom.Document;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
@@ -807,7 +807,7 @@ private String getContentTypeFromString(String value){
 
 		private boolean isJsonString(String value){
 			try {
-				JSONObject json = new JSONObject(value);
+				JSONObjectWrapper json = new JSONObjectWrapper(value);
 				return true;
 			} catch (JSONException e) {
 				return false;
diff --git a/common/src/main/java/com/genexus/internet/GXJSONObject.java b/common/src/main/java/com/genexus/internet/GXJSONObject.java
index ba2089cae..fbaa3955f 100644
--- a/common/src/main/java/com/genexus/internet/GXJSONObject.java
+++ b/common/src/main/java/com/genexus/internet/GXJSONObject.java
@@ -2,9 +2,9 @@
 
 import com.genexus.util.Codecs;
 
-import json.org.json.*;
+import com.genexus.json.JSONObjectWrapper;
 
-public class GXJSONObject extends JSONObject
+public class GXJSONObject extends JSONObjectWrapper
 {
 	private boolean base64Encoded;
 
diff --git a/common/src/main/java/com/genexus/internet/GXNavigationHelper.java b/common/src/main/java/com/genexus/internet/GXNavigationHelper.java
index e478bd7f0..2adfdf8af 100644
--- a/common/src/main/java/com/genexus/internet/GXNavigationHelper.java
+++ b/common/src/main/java/com/genexus/internet/GXNavigationHelper.java
@@ -3,7 +3,7 @@
 import com.genexus.CommonUtil;
 import com.genexus.common.interfaces.SpecificImplementation;
 
-import json.org.json.*;
+import org.json.JSONArray;
 
 import java.io.Serializable;
 
diff --git a/common/src/main/java/com/genexus/internet/IGxJSONAble.java b/common/src/main/java/com/genexus/internet/IGxJSONAble.java
index 23f9e26ca..0f4bb74ec 100644
--- a/common/src/main/java/com/genexus/internet/IGxJSONAble.java
+++ b/common/src/main/java/com/genexus/internet/IGxJSONAble.java
@@ -1,13 +1,11 @@
 package com.genexus.internet;
 
-import json.org.json.*;
-
 public interface IGxJSONAble
 {
     void tojson();
     void AddObjectProperty(String name, Object prop);
     Object GetJSONObject();
     Object GetJSONObject(boolean includeState);
-    void FromJSONObject(IJsonFormattable obj);
+    void FromJSONObject(Object obj);
     String ToJavascriptSource();
 }
diff --git a/common/src/main/java/com/genexus/internet/Msg.java b/common/src/main/java/com/genexus/internet/Msg.java
index db6806003..6d688a65a 100644
--- a/common/src/main/java/com/genexus/internet/Msg.java
+++ b/common/src/main/java/com/genexus/internet/Msg.java
@@ -1,7 +1,6 @@
 package com.genexus.internet;
 
-import json.org.json.IJsonFormattable;
-import json.org.json.JSONObject;
+import com.genexus.json.JSONObjectWrapper;
 
 public class Msg implements java.io.Serializable, IGxJSONAble
 {
@@ -10,7 +9,7 @@ public class Msg implements java.io.Serializable, IGxJSONAble
   protected int type;
   protected String att;
   protected boolean gxMessage;
-  protected JSONObject jsonObj = new JSONObject();
+  protected JSONObjectWrapper jsonObj = new JSONObjectWrapper();
 
   public Msg( String description, String id, int type, String att)
   {
@@ -82,7 +81,7 @@ public Object GetJSONObject()
       return jsonObj;
   }
 
-  public void FromJSONObject(IJsonFormattable obj)
+  public void FromJSONObject(Object obj)
   {
   }
 }
diff --git a/common/src/main/java/com/genexus/internet/MsgList.java b/common/src/main/java/com/genexus/internet/MsgList.java
index cf226988b..dc8cf971d 100644
--- a/common/src/main/java/com/genexus/internet/MsgList.java
+++ b/common/src/main/java/com/genexus/internet/MsgList.java
@@ -4,7 +4,7 @@
 
 import com.genexus.SdtMessages_Message;
 
-import json.org.json.*;
+import org.json.JSONArray;
 
 import com.genexus.GXBaseCollection;
 
@@ -148,7 +148,7 @@ public Object GetJSONObject()
             return jsonArr;
         }
 
-        public void FromJSONObject(IJsonFormattable obj)
+        public void FromJSONObject(Object obj)
         {
         }
 }
diff --git a/common/src/main/java/com/genexus/internet/StringCollection.java b/common/src/main/java/com/genexus/internet/StringCollection.java
index 08ca924ca..c2fe623ab 100644
--- a/common/src/main/java/com/genexus/internet/StringCollection.java
+++ b/common/src/main/java/com/genexus/internet/StringCollection.java
@@ -1,7 +1,7 @@
 package com.genexus.internet;
 import com.genexus.util.*;
 
-import json.org.json.*;
+import org.json.JSONArray;
 
 import com.genexus.CommonUtil;
 import com.genexus.SdtMessages_Message;
@@ -145,7 +145,7 @@ public Object GetJSONObject()
         return jsonArr;
     }
 
-    public void FromJSONObject(IJsonFormattable obj)
+    public void FromJSONObject(Object obj)
     {
     }
 
diff --git a/common/src/main/java/com/genexus/util/GXGeolocation.java b/common/src/main/java/com/genexus/util/GXGeolocation.java
index bfddaa075..2a3f54589 100644
--- a/common/src/main/java/com/genexus/util/GXGeolocation.java
+++ b/common/src/main/java/com/genexus/util/GXGeolocation.java
@@ -13,7 +13,9 @@
 
 import com.genexus.ClientContext;
 import com.genexus.xml.*;
-import json.org.json.*;
+import org.json.JSONObject;
+import org.json.JSONArray;
+import org.json.JSONException;
 
 public class GXGeolocation
 {
diff --git a/common/src/main/java/com/genexus/util/GXProperties.java b/common/src/main/java/com/genexus/util/GXProperties.java
index dc3f1be71..1d6dc111a 100644
--- a/common/src/main/java/com/genexus/util/GXProperties.java
+++ b/common/src/main/java/com/genexus/util/GXProperties.java
@@ -4,7 +4,8 @@
 
 import com.genexus.internet.IGxJSONSerializable;
 
-import json.org.json.*;
+import com.genexus.json.JSONObjectWrapper;
+import org.json.JSONException;
 
 import com.genexus.CommonUtil;
 import com.genexus.SdtMessages_Message;
@@ -103,7 +104,7 @@ public GXProperty next() {
 	}
 
 	public Object GetJSONObject() {
-		JSONObject jObj = new JSONObject();
+		JSONObjectWrapper jObj = new JSONObjectWrapper();
 		int i = 0;
 		while (count() > i) {
 			GXProperty prop = item(i);
@@ -116,7 +117,7 @@ public Object GetJSONObject() {
 	}
 
 	public String toJSonString() {
-		JSONObject jObj = (JSONObject) GetJSONObject();
+		JSONObjectWrapper jObj = (JSONObjectWrapper) GetJSONObject();
 		return jObj.toString();
 	}
 
@@ -128,7 +129,7 @@ public boolean fromJSonString(String s, GXBaseCollection < SdtMessages_Message >
 		this.clear();
 		if (!s.isEmpty()) {
 			try {
-				JSONObject jObj = new JSONObject(s);
+				JSONObjectWrapper jObj = new JSONObjectWrapper(s);
 				Iterator < String > keys = jObj.keys();
 				while (keys.hasNext()) {
 					String key = keys.next();
diff --git a/common/src/main/java/com/genexus/util/IniFile.java b/common/src/main/java/com/genexus/util/IniFile.java
index 9c4e38a00..05d8dae95 100644
--- a/common/src/main/java/com/genexus/util/IniFile.java
+++ b/common/src/main/java/com/genexus/util/IniFile.java
@@ -10,7 +10,7 @@
 
 import com.genexus.diagnostics.core.ILogger;
 import com.genexus.diagnostics.core.LogManager;
-import json.org.json.*;
+import com.genexus.json.JSONObjectWrapper;
 
 
 public class IniFile {
@@ -362,7 +362,7 @@ static ConcurrentHashMap<String, String> getConfMapping(){
 				GXFileInfo mapping = new GXFileInfo(envMapping);
 				try {
 					String jsonTxt = mapping.readAllText("");
-					JSONObject jObject = new JSONObject(jsonTxt);
+					JSONObjectWrapper jObject = new JSONObjectWrapper(jsonTxt);
 
 					s_confMapping = new ConcurrentHashMap<String,String>(); 
 					
diff --git a/common/src/main/java/com/genexus/util/ThemeData.java b/common/src/main/java/com/genexus/util/ThemeData.java
index 55bc718ab..04d5467e6 100644
--- a/common/src/main/java/com/genexus/util/ThemeData.java
+++ b/common/src/main/java/com/genexus/util/ThemeData.java
@@ -2,9 +2,9 @@
 
 import java.util.List;
 
-import json.org.json.JSONArray;
-import json.org.json.JSONException;
-import json.org.json.JSONObject;
+import org.json.JSONArray;
+import org.json.JSONException;
+import com.genexus.json.JSONObjectWrapper;
 
 import java.util.ArrayList;
 
@@ -15,7 +15,7 @@ public class ThemeData
 	
 	public static ThemeData fromJson(String json) throws JSONException
 	{
-		JSONObject jsonObj = new JSONObject(json);
+		JSONObjectWrapper jsonObj = new JSONObjectWrapper(json);
 		
 		ThemeData themeData = new ThemeData();
 		themeData.name = jsonObj.getString("name");
diff --git a/common/src/main/java/com/genexus/util/ThemeHelper.java b/common/src/main/java/com/genexus/util/ThemeHelper.java
index bdd7c272f..d38e4e05f 100644
--- a/common/src/main/java/com/genexus/util/ThemeHelper.java
+++ b/common/src/main/java/com/genexus/util/ThemeHelper.java
@@ -8,8 +8,6 @@
 
 import com.genexus.diagnostics.Log;
 
-import json.org.json.JSONObject;
-
 import com.genexus.CommonUtil;
 import com.genexus.common.interfaces.SpecificImplementation;
 import org.springframework.core.io.ClassPathResource;
diff --git a/common/src/main/java/com/genexus/xml/GXXMLSerializable.java b/common/src/main/java/com/genexus/xml/GXXMLSerializable.java
index 5a8f29603..e9319c148 100644
--- a/common/src/main/java/com/genexus/xml/GXXMLSerializable.java
+++ b/common/src/main/java/com/genexus/xml/GXXMLSerializable.java
@@ -5,7 +5,10 @@
 import com.genexus.common.interfaces.SpecificImplementation;
 import com.genexus.util.GXProperties;
 
-import json.org.json.*;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+import com.genexus.json.JSONObjectWrapper;
 
 import java.io.Serializable;
 import java.util.Iterator;
@@ -35,7 +38,7 @@ public GXXMLSerializable(int remoteHandle, ModelContext context, String type)
 
 	private static final String GET_METHOD_NAME = "getgxTv_";
 	private static final String SET_METHOD_NAME = "setgxTv_";
-	private JSONObject jsonObj = new JSONObject();
+	private JSONObjectWrapper jsonObj = new JSONObjectWrapper();
 	private JSONArray jsonArr = new JSONArray();
 	protected boolean isArrayObject = false;
 	protected String arrayItemName;
@@ -275,7 +278,7 @@ public Object GetJSONObject(boolean includeState)
 	}
 	public Object GetJSONObject(boolean includeState, boolean includeNoInitialized)
 	{
-		jsonObj = new JSONObject();
+		jsonObj = new JSONObjectWrapper();
 		tojson(includeState, includeNoInitialized);
 		if (isArrayObject)
 		{
@@ -314,7 +317,7 @@ private Iterator getFromJSONObjectOrderIterator(Iterator it)
         return v.iterator();
 	}
 
-	public void FromJSONObject(IJsonFormattable obj)
+	public void FromJSONObject(Object obj)
 	{
 		String className = CommonUtil.classNameNoPackage(this.getClass());
 		String name;
@@ -351,7 +354,7 @@ public void FromJSONObject(IJsonFormattable obj)
 		}
 		else
 		{
-			Iterator it = getFromJSONObjectOrderIterator(((JSONObject)obj).keys());
+			Iterator it = getFromJSONObjectOrderIterator(((JSONObjectWrapper)obj).keys());
 			while(it.hasNext())
 			{
 				name = (String)it.next();
@@ -363,7 +366,7 @@ public void FromJSONObject(IJsonFormattable obj)
 					setClass = setMethod.getParameterTypes()[0];
 					try
 					{
-						Object currObj = ((JSONObject)obj).get(name);
+						Object currObj = ((JSONObjectWrapper)obj).get(name);
 						if(GXSimpleCollection.class.isAssignableFrom(setClass))
 						{
 							currColl = (GXSimpleCollection)getMethod.invoke(this, new Object[] {});
@@ -377,12 +380,12 @@ public void FromJSONObject(IJsonFormattable obj)
 						else if(IGxJSONAble.class.isAssignableFrom(setClass))
 						{
 							IGxJSONAble innerObj = (IGxJSONAble)setClass.getConstructor(new Class[] { SpecificImplementation.Application.getModelContextClass() }).newInstance(new Object[] { context });
-							innerObj.FromJSONObject((JSONObject)currObj);
+							innerObj.FromJSONObject(currObj);
 							setMethod.invoke(this, new Object[] { innerObj });
 						}
 						else
 						{
-							if (getMethod.getName().startsWith("getgxTv_") && getMethod.isAnnotationPresent(GxUpload.class) && !((JSONObject)obj).has(name + "_GXI") &&  currObj!=null )
+							if (getMethod.getName().startsWith("getgxTv_") && getMethod.isAnnotationPresent(GxUpload.class) && !((JSONObjectWrapper)obj).has(name + "_GXI") &&  currObj!=null )
 							{
 								if (currObj.getClass().equals(String.class) && ((String)currObj).startsWith(com.genexus.CommonUtil.FORMDATA_REFERENCE))
 								{
@@ -444,7 +447,9 @@ private void collectionFromJSONArray(JSONArray jsonArray, GXSimpleCollection gxC
                 for(int i = 0; i < jsonArray.length(); i++)
                 {
                     Object currObj = jsonArray.get(i);
-                    if(currObj instanceof JSONObject || !gxColl.IsSimpleCollection())
+					if (currObj instanceof JSONObject)
+						currObj = new JSONObjectWrapper((JSONObject)currObj);
+                    if(currObj instanceof JSONObjectWrapper || !gxColl.IsSimpleCollection())
                     {
                         Class<?> innerClass = gxColl.getElementsType();
 						IGxJSONAble innerObj;
@@ -456,7 +461,7 @@ private void collectionFromJSONArray(JSONArray jsonArray, GXSimpleCollection gxC
 						{
 							innerObj = (IGxJSONAble) innerClass.getConstructor(new Class[] {SpecificImplementation.Application.getModelContextClass()}).newInstance(new Object[] { context });
 						}
-                        innerObj.FromJSONObject((IJsonFormattable) currObj);
+                        innerObj.FromJSONObject(currObj);
                         gxColl.addBase(innerObj);
                     }
                     else
@@ -539,7 +544,7 @@ public boolean fromJSonString(String s, GXBaseCollection<SdtMessages_Message> me
 	{
 		try
 		{
-			jsonObj = new JSONObject(s);
+			jsonObj = new JSONObjectWrapper(s);
 			FromJSONObject(jsonObj);
 			return true;
 		}
diff --git a/common/src/main/java/json/org/json/CDL.java b/common/src/main/java/json/org/json/CDL.java
deleted file mode 100644
index 849aa7489..000000000
--- a/common/src/main/java/json/org/json/CDL.java
+++ /dev/null
@@ -1,261 +0,0 @@
-package json.org.json;
-
-/*
-Copyright (c) 2002 JSON.org
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-The Software shall be used for Good, not Evil.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-*/
-
-/**
- * This provides static methods to convert comma delimited text into a
- * JSONArray, and to covert a JSONArray into comma delimited text. Comma
- * delimited text is a very popular format for data interchange. It is
- * understood by most database, spreadsheet, and organizer programs.
- * <p>
- * Each row of text represents a row in a table or a data record. Each row
- * ends with a NEWLINE character. Each row contains one or more values.
- * Values are separated by commas. A value can contain any character except
- * for comma, unless is is wrapped in single quotes or double quotes.
- * <p>
- * The first row usually contains the names of the columns.
- * <p>
- * A comma delimited list can be converted into a JSONArray of JSONObjects.
- * The names for the elements in the JSONObjects can be taken from the names
- * in the first row.
- * @author JSON.org
- * @version 2
- */
-public class CDL {
-
-    /**
-     * Get the next value. The value can be wrapped in quotes. The value can
-     * be empty.
-     * @param x A JSONTokener of the source text.
-     * @return The value string, or null if empty.
-     * @throws JSONException if the quoted string is badly formed.
-     */
-    private static String getValue(JSONTokener x) throws JSONException {
-        char c;
-        do {
-            c = x.next();
-        } while (c <= ' ' && c != 0);
-        switch (c) {
-        case 0:
-            return null;
-        case '"':
-        case '\'':
-            return x.nextString(c);
-        case ',':
-            x.back();
-            return "";
-        default:
-            x.back();
-            return x.nextTo(',');
-        }
-    }
-
-    /**
-     * Produce a JSONArray of strings from a row of comma delimited values.
-     * @param x A JSONTokener of the source text.
-     * @return A JSONArray of strings.
-     * @throws JSONException
-     */
-    public static JSONArray rowToJSONArray(JSONTokener x) throws JSONException {
-        JSONArray ja = new JSONArray();
-        for (;;) {
-            String value = getValue(x);
-            if (value == null) {
-                return null;
-            }
-            ja.put(value);
-            for (;;) {
-                char c = x.next();
-                if (c == ',') {
-                    break;
-                }
-                if (c != ' ') {
-                    if (c == '\n' || c == '\r' || c == 0) {
-                        return ja;
-                    }
-                    throw x.syntaxError("Bad character '" + c + "' (" +
-                            (int)c + ").");
-                }
-            }
-        }
-    }
-
-    /**
-     * Produce a JSONObject from a row of comma delimited text, using a
-     * parallel JSONArray of strings to provides the names of the elements.
-     * @param names A JSONArray of names. This is commonly obtained from the
-     *  first row of a comma delimited text file using the rowToJSONArray
-     *  method.
-     * @param x A JSONTokener of the source text.
-     * @return A JSONObject combining the names and values.
-     * @throws JSONException
-     */
-    public static JSONObject rowToJSONObject(JSONArray names, JSONTokener x)
-            throws JSONException {
-        JSONArray ja = rowToJSONArray(x);
-        return ja != null ? ja.toJSONObject(names) :  null;
-    }
-
-    /**
-     * Produce a JSONArray of JSONObjects from a comma delimited text string,
-     * using the first row as a source of names.
-     * @param string The comma delimited text.
-     * @return A JSONArray of JSONObjects.
-     * @throws JSONException
-     */
-    public static JSONArray toJSONArray(String string) throws JSONException {
-        return toJSONArray(new JSONTokener(string));
-    }
-
-    /**
-     * Produce a JSONArray of JSONObjects from a comma delimited text string,
-     * using the first row as a source of names.
-     * @param x The JSONTokener containing the comma delimited text.
-     * @return A JSONArray of JSONObjects.
-     * @throws JSONException
-     */
-    public static JSONArray toJSONArray(JSONTokener x) throws JSONException {
-        return toJSONArray(rowToJSONArray(x), x);
-    }
-
-    /**
-     * Produce a JSONArray of JSONObjects from a comma delimited text string
-     * using a supplied JSONArray as the source of element names.
-     * @param names A JSONArray of strings.
-     * @param string The comma delimited text.
-     * @return A JSONArray of JSONObjects.
-     * @throws JSONException
-     */
-    public static JSONArray toJSONArray(JSONArray names, String string)
-            throws JSONException {
-        return toJSONArray(names, new JSONTokener(string));
-    }
-
-    /**
-     * Produce a JSONArray of JSONObjects from a comma delimited text string
-     * using a supplied JSONArray as the source of element names.
-     * @param names A JSONArray of strings.
-     * @param x A JSONTokener of the source text.
-     * @return A JSONArray of JSONObjects.
-     * @throws JSONException
-     */
-    public static JSONArray toJSONArray(JSONArray names, JSONTokener x)
-            throws JSONException {
-        if (names == null || names.length() == 0) {
-            return null;
-        }
-        JSONArray ja = new JSONArray();
-        for (;;) {
-            JSONObject jo = rowToJSONObject(names, x);
-            if (jo == null) {
-                break;
-            }
-            ja.put(jo);
-        }
-        if (ja.length() == 0) {
-            return null;
-        }
-        return ja;
-    }
-
-
-    /**
-     * Produce a comma delimited text row from a JSONArray. Values containing
-     * the comma character will be quoted.
-     * @param ja A JSONArray of strings.
-     * @return A string ending in NEWLINE.
-     */
-    public static String rowToString(JSONArray ja) {
-        StringBuffer sb = new StringBuffer();
-        for (int i = 0; i < ja.length(); i += 1) {
-            if (i > 0) {
-                sb.append(',');
-            }
-            Object o = ja.opt(i);
-            if (o != null) {
-                String s = o.toString();
-                if (s.indexOf(',') >= 0) {
-                    if (s.indexOf('"') >= 0) {
-                        sb.append('\'');
-                        sb.append(s);
-                        sb.append('\'');
-                    } else {
-                        sb.append('"');
-                        sb.append(s);
-                        sb.append('"');
-                    }
-                } else {
-                    sb.append(s);
-                }
-            }
-        }
-        sb.append('\n');
-        return sb.toString();
-
-    }
-
-    /**
-     * Produce a comma delimited text from a JSONArray of JSONObjects. The
-     * first row will be a list of names obtained by inspecting the first
-     * JSONObject.
-     * @param ja A JSONArray of JSONObjects.
-     * @return A comma delimited text.
-     * @throws JSONException
-     */
-    public static String toString(JSONArray ja) throws JSONException {
-        JSONObject jo = ja.optJSONObject(0);
-        if (jo != null) {
-            JSONArray names = jo.names();
-            if (names != null) {
-                return rowToString(names) + toString(names, ja);
-            }
-        }
-        return null;
-    }
-
-    /**
-     * Produce a comma delimited text from a JSONArray of JSONObjects using
-     * a provided list of names. The list of names is not included in the
-     * output.
-     * @param names A JSONArray of strings.
-     * @param ja A JSONArray of JSONObjects.
-     * @return A comma delimited text.
-     * @throws JSONException
-     */
-    public static String toString(JSONArray names, JSONArray ja)
-            throws JSONException {
-        if (names == null || names.length() == 0) {
-            return null;
-        }
-        StringBuffer sb = new StringBuffer();
-        for (int i = 0; i < ja.length(); i += 1) {
-            JSONObject jo = ja.optJSONObject(i);
-            if (jo != null) {
-                sb.append(rowToString(jo.toJSONArray(names)));
-            }
-        }
-        return sb.toString();
-    }
-}
diff --git a/common/src/main/java/json/org/json/Cookie.java b/common/src/main/java/json/org/json/Cookie.java
deleted file mode 100644
index 160591de5..000000000
--- a/common/src/main/java/json/org/json/Cookie.java
+++ /dev/null
@@ -1,169 +0,0 @@
-package json.org.json;
-
-/*
-Copyright (c) 2002 JSON.org
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-The Software shall be used for Good, not Evil.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-*/
-
-/**
- * Convert a web browser cookie specification to a JSONObject and back.
- * JSON and Cookies are both notations for name/value pairs.
- * @author JSON.org
- * @version 2
- */
-public class Cookie {
-
-    /**
-     * Produce a copy of a string in which the characters '+', '%', '=', ';'
-     * and control characters are replaced with "%hh". This is a gentle form
-     * of URL encoding, attempting to cause as little distortion to the
-     * string as possible. The characters '=' and ';' are meta characters in
-     * cookies. By convention, they are escaped using the URL-encoding. This is
-     * only a convention, not a standard. Often, cookies are expected to have
-     * encoded values. We encode '=' and ';' because we must. We encode '%' and
-     * '+' because they are meta characters in URL encoding.
-     * @param string The source string.
-     * @return       The escaped result.
-     */
-    public static String escape(String string) {
-        char         c;
-        String       s = string.trim();
-        StringBuffer sb = new StringBuffer();
-        int          len = s.length();
-        for (int i = 0; i < len; i += 1) {
-            c = s.charAt(i);
-            if (c < ' ' || c == '+' || c == '%' || c == '=' || c == ';') {
-                sb.append('%');
-                sb.append(Character.forDigit((char)((c >>> 4) & 0x0f), 16));
-                sb.append(Character.forDigit((char)(c & 0x0f), 16));
-            } else {
-                sb.append(c);
-            }
-        }
-        return sb.toString();
-    }
-
-
-    /**
-     * Convert a cookie specification string into a JSONObject. The string
-     * will contain a name value pair separated by '='. The name and the value
-     * will be unescaped, possibly converting '+' and '%' sequences. The
-     * cookie properties may follow, separated by ';', also represented as
-     * name=value (except the secure property, which does not have a value).
-     * The name will be stored under the key "name", and the value will be
-     * stored under the key "value". This method does not do checking or
-     * validation of the parameters. It only converts the cookie string into
-     * a JSONObject.
-     * @param string The cookie specification string.
-     * @return A JSONObject containing "name", "value", and possibly other
-     *  members.
-     * @throws JSONException
-     */
-    public static JSONObject toJSONObject(String string) throws JSONException {
-        String         n;
-        JSONObject     o = new JSONObject();
-        Object         v;
-        JSONTokener x = new JSONTokener(string);
-        o.put("name", x.nextTo('='));
-        x.next('=');
-        o.put("value", x.nextTo(';'));
-        x.next();
-        while (x.more()) {
-            n = unescape(x.nextTo("=;"));
-            if (x.next() != '=') {
-                if (n.equals("secure")) {
-                    v = Boolean.TRUE;
-                } else {
-                    throw x.syntaxError("Missing '=' in cookie parameter.");
-                }
-            } else {
-                v = unescape(x.nextTo(';'));
-                x.next();
-            }
-            o.put(n, v);
-        }
-        return o;
-    }
-
-
-    /**
-     * Convert a JSONObject into a cookie specification string. The JSONObject
-     * must contain "name" and "value" members.
-     * If the JSONObject contains "expires", "domain", "path", or "secure"
-     * members, they will be appended to the cookie specification string.
-     * All other members are ignored.
-     * @param o A JSONObject
-     * @return A cookie specification string
-     * @throws JSONException
-     */
-    public static String toString(JSONObject o) throws JSONException {
-        StringBuffer sb = new StringBuffer();
-
-        sb.append(escape(o.getString("name")));
-        sb.append("=");
-        sb.append(escape(o.getString("value")));
-        if (o.has("expires")) {
-            sb.append(";expires=");
-            sb.append(o.getString("expires"));
-        }
-        if (o.has("domain")) {
-            sb.append(";domain=");
-            sb.append(escape(o.getString("domain")));
-        }
-        if (o.has("path")) {
-            sb.append(";path=");
-            sb.append(escape(o.getString("path")));
-        }
-        if (o.optBoolean("secure")) {
-            sb.append(";secure");
-        }
-        return sb.toString();
-    }
-
-    /**
-     * Convert <code>%</code><i>hh</i> sequences to single characters, and
-     * convert plus to space.
-     * @param s A string that may contain
-     *      <code>+</code>&nbsp;<small>(plus)</small> and
-     *      <code>%</code><i>hh</i> sequences.
-     * @return The unescaped string.
-     */
-    public static String unescape(String s) {
-        int len = s.length();
-        StringBuffer b = new StringBuffer();
-        for (int i = 0; i < len; ++i) {
-            char c = s.charAt(i);
-            if (c == '+') {
-                c = ' ';
-            } else if (c == '%' && i + 2 < len) {
-                int d = JSONTokener.dehexchar(s.charAt(i + 1));
-                int e = JSONTokener.dehexchar(s.charAt(i + 2));
-                if (d >= 0 && e >= 0) {
-                    c = (char)(d * 16 + e);
-                    i += 2;
-                }
-            }
-            b.append(c);
-        }
-        return b.toString();
-    }
-}
diff --git a/common/src/main/java/json/org/json/CookieList.java b/common/src/main/java/json/org/json/CookieList.java
deleted file mode 100644
index d20a053e9..000000000
--- a/common/src/main/java/json/org/json/CookieList.java
+++ /dev/null
@@ -1,90 +0,0 @@
-package json.org.json;
-
-/*
-Copyright (c) 2002 JSON.org
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-The Software shall be used for Good, not Evil.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-*/
-
-import java.util.Iterator;
-
-/**
- * Convert a web browser cookie list string to a JSONObject and back.
- * @author JSON.org
- * @version 2
- */
-public class CookieList {
-
-    /**
-     * Convert a cookie list into a JSONObject. A cookie list is a sequence
-     * of name/value pairs. The names are separated from the values by '='.
-     * The pairs are separated by ';'. The names and the values
-     * will be unescaped, possibly converting '+' and '%' sequences.
-     *
-     * To add a cookie to a cooklist,
-     * cookielistJSONObject.put(cookieJSONObject.getString("name"),
-     *     cookieJSONObject.getString("value"));
-     * @param string  A cookie list string
-     * @return A JSONObject
-     * @throws JSONException
-     */
-    public static JSONObject toJSONObject(String string) throws JSONException {
-        JSONObject o = new JSONObject();
-        JSONTokener x = new JSONTokener(string);
-        while (x.more()) {
-            String name = Cookie.unescape(x.nextTo('='));
-            x.next('=');
-            o.put(name, Cookie.unescape(x.nextTo(';')));
-            x.next();
-        }
-        return o;
-    }
-
-
-    /**
-     * Convert a JSONObject into a cookie list. A cookie list is a sequence
-     * of name/value pairs. The names are separated from the values by '='.
-     * The pairs are separated by ';'. The characters '%', '+', '=', and ';'
-     * in the names and values are replaced by "%hh".
-     * @param o A JSONObject
-     * @return A cookie list string
-     * @throws JSONException
-     */
-    public static String toString(JSONObject o) throws JSONException {
-        boolean      b = false;
-        Iterator     keys = o.keys();
-        String       s;
-        StringBuffer sb = new StringBuffer();
-        while (keys.hasNext()) {
-            s = keys.next().toString();
-            if (!o.isNull(s)) {
-                if (b) {
-                    sb.append(';');
-                }
-                sb.append(Cookie.escape(s));
-                sb.append("=");
-                sb.append(Cookie.escape(o.getString(s)));
-                b = true;
-            }
-        }
-        return sb.toString();
-    }
-}
diff --git a/common/src/main/java/json/org/json/HTTP.java b/common/src/main/java/json/org/json/HTTP.java
deleted file mode 100644
index 6d34cc26a..000000000
--- a/common/src/main/java/json/org/json/HTTP.java
+++ /dev/null
@@ -1,163 +0,0 @@
-package json.org.json;
-
-/*
-Copyright (c) 2002 JSON.org
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-The Software shall be used for Good, not Evil.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-*/
-
-import java.util.Iterator;
-
-/**
- * Convert an HTTP header to a JSONObject and back.
- * @author JSON.org
- * @version 2
- */
-public class HTTP {
-
-    /** Carriage return/line feed. */
-    public static final String CRLF = "\r\n";
-
-    /**
-     * Convert an HTTP header string into a JSONObject. It can be a request
-     * header or a response header. A request header will contain
-     * <pre>{
-     *    Method: "POST" (for example),
-     *    "Request-URI": "/" (for example),
-     *    "HTTP-Version": "HTTP/1.1" (for example)
-     * }</pre>
-     * A response header will contain
-     * <pre>{
-     *    "HTTP-Version": "HTTP/1.1" (for example),
-     *    "Status-Code": "200" (for example),
-     *    "Reason-Phrase": "OK" (for example)
-     * }</pre>
-     * In addition, the other parameters in the header will be captured, using
-     * the HTTP field names as JSON names, so that <pre>
-     *    Date: Sun, 26 May 2002 18:06:04 GMT
-     *    Cookie: Q=q2=PPEAsg--; B=677gi6ouf29bn&b=2&f=s
-     *    Cache-Control: no-cache</pre>
-     * become
-     * <pre>{...
-     *    Date: "Sun, 26 May 2002 18:06:04 GMT",
-     *    Cookie: "Q=q2=PPEAsg--; B=677gi6ouf29bn&b=2&f=s",
-     *    "Cache-Control": "no-cache",
-     * ...}</pre>
-     * It does no further checking or conversion. It does not parse dates.
-     * It does not do '%' transforms on URLs.
-     * @param string An HTTP header string.
-     * @return A JSONObject containing the elements and attributes
-     * of the XML string.
-     * @throws JSONException
-     */
-    public static JSONObject toJSONObject(String string) throws JSONException {
-        JSONObject     o = new JSONObject();
-        HTTPTokener    x = new HTTPTokener(string);
-        String         t;
-
-        t = x.nextToken();
-        if (t.toUpperCase().startsWith("HTTP")) {
-
-// Response
-
-            o.put("HTTP-Version", t);
-            o.put("Status-Code", x.nextToken());
-            o.put("Reason-Phrase", x.nextTo('\0'));
-            x.next();
-
-        } else {
-
-// Request
-
-            o.put("Method", t);
-            o.put("Request-URI", x.nextToken());
-            o.put("HTTP-Version", x.nextToken());
-        }
-
-// Fields
-
-        while (x.more()) {
-            String name = x.nextTo(':');
-            x.next(':');
-            o.put(name, x.nextTo('\0'));
-            x.next();
-        }
-        return o;
-    }
-
-
-    /**
-     * Convert a JSONObject into an HTTP header. A request header must contain
-     * <pre>{
-     *    Method: "POST" (for example),
-     *    "Request-URI": "/" (for example),
-     *    "HTTP-Version": "HTTP/1.1" (for example)
-     * }</pre>
-     * A response header must contain
-     * <pre>{
-     *    "HTTP-Version": "HTTP/1.1" (for example),
-     *    "Status-Code": "200" (for example),
-     *    "Reason-Phrase": "OK" (for example)
-     * }</pre>
-     * Any other members of the JSONObject will be output as HTTP fields.
-     * The result will end with two CRLF pairs.
-     * @param o A JSONObject
-     * @return An HTTP header string.
-     * @throws JSONException if the object does not contain enough
-     *  information.
-     */
-    public static String toString(JSONObject o) throws JSONException {
-        Iterator     keys = o.keys();
-        String       s;
-        StringBuffer sb = new StringBuffer();
-        if (o.has("Status-Code") && o.has("Reason-Phrase")) {
-            sb.append(o.getString("HTTP-Version"));
-            sb.append(' ');
-            sb.append(o.getString("Status-Code"));
-            sb.append(' ');
-            sb.append(o.getString("Reason-Phrase"));
-        } else if (o.has("Method") && o.has("Request-URI")) {
-            sb.append(o.getString("Method"));
-            sb.append(' ');
-            sb.append('"');
-            sb.append(o.getString("Request-URI"));
-            sb.append('"');
-            sb.append(' ');
-            sb.append(o.getString("HTTP-Version"));
-        } else {
-            throw new JSONException("Not enough material for an HTTP header.");
-        }
-        sb.append(CRLF);
-        while (keys.hasNext()) {
-            s = keys.next().toString();
-            if (!s.equals("HTTP-Version")      && !s.equals("Status-Code") &&
-                    !s.equals("Reason-Phrase") && !s.equals("Method") &&
-                    !s.equals("Request-URI")   && !o.isNull(s)) {
-                sb.append(s);
-                sb.append(": ");
-                sb.append(o.getString(s));
-                sb.append(CRLF);
-            }
-        }
-        sb.append(CRLF);
-        return sb.toString();
-    }
-}
diff --git a/common/src/main/java/json/org/json/HTTPTokener.java b/common/src/main/java/json/org/json/HTTPTokener.java
deleted file mode 100644
index bc8c4d225..000000000
--- a/common/src/main/java/json/org/json/HTTPTokener.java
+++ /dev/null
@@ -1,77 +0,0 @@
-package json.org.json;
-
-/*
-Copyright (c) 2002 JSON.org
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-The Software shall be used for Good, not Evil.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-*/
-
-/**
- * The HTTPTokener extends the JSONTokener to provide additional methods
- * for the parsing of HTTP headers.
- * @author JSON.org
- * @version 2
- */
-public class HTTPTokener extends JSONTokener {
-
-    /**
-     * Construct an XMLTokener from a string.
-     * @param s A source string.
-     */
-    public HTTPTokener(String s) {
-        super(s);
-    }
-
-
-    /**
-     * Get the next token or string. This is used in parsing HTTP headers.
-     * @throws JSONException
-     * @return A String.
-     */
-    public String nextToken() throws JSONException {
-        char c;
-        char q;
-        StringBuffer sb = new StringBuffer();
-        do {
-            c = next();
-        } while (Character.isWhitespace(c));
-        if (c == '"' || c == '\'') {
-            q = c;
-            for (;;) {
-                c = next();
-                if (c < ' ') {
-                    throw syntaxError("Unterminated string.");
-                }
-                if (c == q) {
-                    return sb.toString();
-                }
-                sb.append(c);
-            }
-        }
-        for (;;) {
-            if (c == 0 || Character.isWhitespace(c)) {
-                return sb.toString();
-            }
-            sb.append(c);
-            c = next();
-        }
-    }
-}
diff --git a/common/src/main/java/json/org/json/IExtensionJSONObject.java b/common/src/main/java/json/org/json/IExtensionJSONObject.java
deleted file mode 100644
index b7e85c963..000000000
--- a/common/src/main/java/json/org/json/IExtensionJSONObject.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package json.org.json;
-
-public interface IExtensionJSONObject {
-	String dateToString(java.util.Date d)
-            throws JSONException;
-}
diff --git a/common/src/main/java/json/org/json/IJsonFormattable.java b/common/src/main/java/json/org/json/IJsonFormattable.java
deleted file mode 100644
index c9d752d48..000000000
--- a/common/src/main/java/json/org/json/IJsonFormattable.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package json.org.json;
-
-public interface IJsonFormattable
-{
-}
diff --git a/common/src/main/java/json/org/json/JSONArray.java b/common/src/main/java/json/org/json/JSONArray.java
deleted file mode 100644
index 61a16dfe0..000000000
--- a/common/src/main/java/json/org/json/JSONArray.java
+++ /dev/null
@@ -1,890 +0,0 @@
-package json.org.json;
-
-/*
-Copyright (c) 2002 JSON.org
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-The Software shall be used for Good, not Evil.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-*/
-
-import java.io.IOException;
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Map;
-import java.util.Iterator;
-
-/**
- * A JSONArray is an ordered sequence of values. Its external text form is a
- * string wrapped in square brackets with commas separating the values. The
- * internal form is an object having <code>get</code> and <code>opt</code>
- * methods for accessing the values by index, and <code>put</code> methods for
- * adding or replacing values. The values can be any of these types:
- * <code>Boolean</code>, <code>JSONArray</code>, <code>JSONObject</code>,
- * <code>Number</code>, <code>String</code>, or the
- * <code>JSONObject.NULL object</code>.
- * <p>
- * The constructor can convert a JSON text into a Java object. The
- * <code>toString</code> method converts to JSON text.
- * <p>
- * A <code>get</code> method returns a value if one can be found, and throws an
- * exception if one cannot be found. An <code>opt</code> method returns a
- * default value instead of throwing an exception, and so is useful for
- * obtaining optional values.
- * <p>
- * The generic <code>get()</code> and <code>opt()</code> methods return an
- * object which you can cast or query for type. There are also typed
- * <code>get</code> and <code>opt</code> methods that do type checking and type
- * coersion for you.
- * <p>
- * The texts produced by the <code>toString</code> methods strictly conform to
- * JSON syntax rules. The constructors are more forgiving in the texts they will
- * accept:
- * <ul>
- * <li>An extra <code>,</code>&nbsp;<small>(comma)</small> may appear just
- *     before the closing bracket.</li>
- * <li>The <code>null</code> value will be inserted when there
- *     is <code>,</code>&nbsp;<small>(comma)</small> elision.</li>
- * <li>Strings may be quoted with <code>'</code>&nbsp;<small>(single
- *     quote)</small>.</li>
- * <li>Strings do not need to be quoted at all if they do not begin with a quote
- *     or single quote, and if they do not contain leading or trailing spaces,
- *     and if they do not contain any of these characters:
- *     <code>{ } [ ] / \ : , = ; #</code> and if they do not look like numbers
- *     and if they are not the reserved words <code>true</code>,
- *     <code>false</code>, or <code>null</code>.</li>
- * <li>Values can be separated by <code>;</code> <small>(semicolon)</small> as
- *     well as by <code>,</code> <small>(comma)</small>.</li>
- * <li>Numbers may have the <code>0-</code> <small>(octal)</small> or
- *     <code>0x-</code> <small>(hex)</small> prefix.</li>
- * <li>Comments written in the slashshlash, slashstar, and hash conventions
- *     will be ignored.</li>
- * </ul>
-
- * @author JSON.org
- * @version 2
- */
-public class JSONArray implements IJsonFormattable, java.io.Serializable {
-
-
-    /**
-     * The arrayList where the JSONArray's properties are kept.
-     */
-    private ArrayList<Object> myArrayList;
-
-
-    /**
-     * Construct an empty JSONArray.
-     */
-    public JSONArray() {
-        this.myArrayList = new ArrayList<>();
-    }
-
-    /**
-     * Construct a JSONArray from a JSONTokener.
-     * @param x A JSONTokener
-     * @throws JSONException If there is a syntax error.
-     */
-    public JSONArray(JSONTokener x) throws JSONException {
-        this();
-        if (x.nextClean() != '[') {
-            throw x.syntaxError("A JSONArray text must start with '['");
-        }
-        if (x.nextClean() == ']') {
-            return;
-        }
-        x.back();
-        for (;;) {
-            if (x.nextClean() == ',') {
-                x.back();
-                this.myArrayList.add(null);
-            } else {
-                x.back();
-                this.myArrayList.add(x.nextValue());
-            }
-            switch (x.nextClean()) {
-            case ';':
-            case ',':
-                if (x.nextClean() == ']') {
-                    return;
-                }
-                x.back();
-                break;
-            case ']':
-                return;
-            default:
-                throw x.syntaxError("Expected a ',' or ']'");
-            }
-        }
-    }
-
-
-    /**
-     * Construct a JSONArray from a source sJSON text.
-     * @param string     A string that begins with
-     * <code>[</code>&nbsp;<small>(left bracket)</small>
-     *  and ends with <code>]</code>&nbsp;<small>(right bracket)</small>.
-     *  @throws JSONException If there is a syntax error.
-     */
-    public JSONArray(String string) throws JSONException {
-        this(new JSONTokener(string));
-    }
-
-
-    /**
-     * Construct a JSONArray from a Collection.
-     * @param collection     A Collection.
-     */
-	@SuppressWarnings("unchecked")
-    public JSONArray(Collection collection) {
-        this.myArrayList = (collection == null) ?
-        	new ArrayList<>() :
-	        new ArrayList<>(collection);
-    }
-
-    /**
-     * Clears all keys and values stored in the JSONArray.
-     *
-     */
-    public void clear() {
-        this.myArrayList.clear();
-    }
-
-    /**
-     * Get the object value associated with an index.
-     * @param index
-     *  The index must be between 0 and length() - 1.
-     * @return An object value.
-     * @throws JSONException If there is no value for the index.
-     */
-    public Object get(int index) throws JSONException {
-        Object o = opt(index);
-        if (o == null) {
-            throw new JSONException("JSONArray[" + index + "] not found.");
-        }
-        return o;
-    }
-
-
-    /**
-     * Get the boolean value associated with an index.
-     * The string values "true" and "false" are converted to boolean.
-     *
-     * @param index The index must be between 0 and length() - 1.
-     * @return      The truth.
-     * @throws JSONException If there is no value for the index or if the
-     *  value is not convertable to boolean.
-     */
-    public boolean getBoolean(int index) throws JSONException {
-        Object o = get(index);
-        if (o.equals(Boolean.FALSE) ||
-                (o instanceof String &&
-                ((String)o).equalsIgnoreCase("false"))) {
-            return false;
-        } else if (o.equals(Boolean.TRUE) ||
-                (o instanceof String &&
-                ((String)o).equalsIgnoreCase("true"))) {
-            return true;
-        }
-        throw new JSONException("JSONArray[" + index + "] is not a Boolean.");
-    }
-
-
-    /**
-     * Get the double value associated with an index.
-     *
-     * @param index The index must be between 0 and length() - 1.
-     * @return      The value.
-     * @throws   JSONException If the key is not found or if the value cannot
-     *  be converted to a number.
-     */
-    public double getDouble(int index) throws JSONException {
-        Object o = get(index);
-        try {
-            return o instanceof Number ?
-                ((Number)o).doubleValue() :
-                Double.valueOf((String)o).doubleValue();
-        } catch (Exception e) {
-            throw new JSONException("JSONArray[" + index +
-                "] is not a number.");
-        }
-    }
-
-
-    /**
-     * Get the int value associated with an index.
-     *
-     * @param index The index must be between 0 and length() - 1.
-     * @return      The value.
-     * @throws   JSONException If the key is not found or if the value cannot
-     *  be converted to a number.
-     *  if the value cannot be converted to a number.
-     */
-    public int getInt(int index) throws JSONException {
-        Object o = get(index);
-        return o instanceof Number ?
-                ((Number)o).intValue() : (int)getDouble(index);
-    }
-
-
-    /**
-     * Get the JSONArray associated with an index.
-     * @param index The index must be between 0 and length() - 1.
-     * @return      A JSONArray value.
-     * @throws JSONException If there is no value for the index. or if the
-     * value is not a JSONArray
-     */
-    public JSONArray getJSONArray(int index) throws JSONException {
-        Object o = get(index);
-        if (o instanceof JSONArray) {
-            return (JSONArray)o;
-        }
-        throw new JSONException("JSONArray[" + index +
-                "] is not a JSONArray.");
-    }
-
-
-    /**
-     * Get the JSONObject associated with an index.
-     * @param index subscript
-     * @return      A JSONObject value.
-     * @throws JSONException If there is no value for the index or if the
-     * value is not a JSONObject
-     */
-    public JSONObject getJSONObject(int index) throws JSONException {
-        Object o = get(index);
-        if (o instanceof JSONObject) {
-            return (JSONObject)o;
-        }
-        throw new JSONException("JSONArray[" + index +
-            "] is not a JSONObject.");
-    }
-
-
-    /**
-     * Get the long value associated with an index.
-     *
-     * @param index The index must be between 0 and length() - 1.
-     * @return      The value.
-     * @throws   JSONException If the key is not found or if the value cannot
-     *  be converted to a number.
-     */
-    public long getLong(int index) throws JSONException {
-        Object o = get(index);
-        return o instanceof Number ?
-                ((Number)o).longValue() : (long)getDouble(index);
-    }
-
-
-    /**
-     * Get the string associated with an index.
-     * @param index The index must be between 0 and length() - 1.
-     * @return      A string value.
-     * @throws JSONException If there is no value for the index.
-     */
-    public String getString(int index) throws JSONException {
-        return get(index).toString();
-    }
-
-
-    /**
-     * Determine if the value is null.
-     * @param index The index must be between 0 and length() - 1.
-     * @return true if the value at the index is null, or if there is no value.
-     */
-    public boolean isNull(int index) {
-        return JSONObject.NULL.equals(opt(index));
-    }
-
-
-    /**
-     * Make a string from the contents of this JSONArray. The
-     * <code>separator</code> string is inserted between each element.
-     * Warning: This method assumes that the data structure is acyclical.
-     * @param separator A string that will be inserted between the elements.
-     * @return a string.
-     * @throws JSONException If the array contains an invalid number.
-     */
-    public String join(String separator) throws JSONException {
-        int len = length();
-		StringBuilder sb = new StringBuilder();
-
-        for (int i = 0; i < len; i += 1) {
-            if (i > 0) {
-                sb.append(separator);
-            }
-            sb.append(JSONObject.valueToString(this.myArrayList.get(i)));
-        }
-        return sb.toString();
-    }
-
-
-    /**
-     * Get the number of elements in the JSONArray, included nulls.
-     *
-     * @return The length (or size).
-     */
-    public int length() {
-        return this.myArrayList.size();
-    }
-
-
-    /**
-     * Get the optional object value associated with an index.
-     * @param index The index must be between 0 and length() - 1.
-     * @return      An object value, or null if there is no
-     *              object at that index.
-     */
-    public Object opt(int index) {
-        return (index < 0 || index >= length()) ?
-            null : this.myArrayList.get(index);
-    }
-
-
-    /**
-     * Get the optional boolean value associated with an index.
-     * It returns false if there is no value at that index,
-     * or if the value is not Boolean.TRUE or the String "true".
-     *
-     * @param index The index must be between 0 and length() - 1.
-     * @return      The truth.
-     */
-    public boolean optBoolean(int index)  {
-        return optBoolean(index, false);
-    }
-
-
-    /**
-     * Get the optional boolean value associated with an index.
-     * It returns the defaultValue if there is no value at that index or if
-     * it is not a Boolean or the String "true" or "false" (case insensitive).
-     *
-     * @param index The index must be between 0 and length() - 1.
-     * @param defaultValue     A boolean default.
-     * @return      The truth.
-     */
-    public boolean optBoolean(int index, boolean defaultValue)  {
-        try {
-            return getBoolean(index);
-        } catch (Exception e) {
-            return defaultValue;
-        }
-    }
-
-
-    /**
-     * Get the optional double value associated with an index.
-     * NaN is returned if there is no value for the index,
-     * or if the value is not a number and cannot be converted to a number.
-     *
-     * @param index The index must be between 0 and length() - 1.
-     * @return      The value.
-     */
-    public double optDouble(int index) {
-        return optDouble(index, Double.NaN);
-    }
-
-
-    /**
-     * Get the optional double value associated with an index.
-     * The defaultValue is returned if there is no value for the index,
-     * or if the value is not a number and cannot be converted to a number.
-     *
-     * @param index subscript
-     * @param defaultValue     The default value.
-     * @return      The value.
-     */
-    public double optDouble(int index, double defaultValue) {
-        try {
-            return getDouble(index);
-        } catch (Exception e) {
-            return defaultValue;
-        }
-    }
-
-
-    /**
-     * Get the optional int value associated with an index.
-     * Zero is returned if there is no value for the index,
-     * or if the value is not a number and cannot be converted to a number.
-     *
-     * @param index The index must be between 0 and length() - 1.
-     * @return      The value.
-     */
-    public int optInt(int index) {
-        return optInt(index, 0);
-    }
-
-
-    /**
-     * Get the optional int value associated with an index.
-     * The defaultValue is returned if there is no value for the index,
-     * or if the value is not a number and cannot be converted to a number.
-     * @param index The index must be between 0 and length() - 1.
-     * @param defaultValue     The default value.
-     * @return      The value.
-     */
-    public int optInt(int index, int defaultValue) {
-        try {
-            return getInt(index);
-        } catch (Exception e) {
-            return defaultValue;
-        }
-    }
-
-
-    /**
-     * Get the optional JSONArray associated with an index.
-     * @param index subscript
-     * @return      A JSONArray value, or null if the index has no value,
-     * or if the value is not a JSONArray.
-     */
-    public JSONArray optJSONArray(int index) {
-        Object o = opt(index);
-        return o instanceof JSONArray ? (JSONArray)o : null;
-    }
-
-
-    /**
-     * Get the optional JSONObject associated with an index.
-     * Null is returned if the key is not found, or null if the index has
-     * no value, or if the value is not a JSONObject.
-     *
-     * @param index The index must be between 0 and length() - 1.
-     * @return      A JSONObject value.
-     */
-    public JSONObject optJSONObject(int index) {
-        Object o = opt(index);
-        return o instanceof JSONObject ? (JSONObject)o : null;
-    }
-
-
-    /**
-     * Get the optional long value associated with an index.
-     * Zero is returned if there is no value for the index,
-     * or if the value is not a number and cannot be converted to a number.
-     *
-     * @param index The index must be between 0 and length() - 1.
-     * @return      The value.
-     */
-    public long optLong(int index) {
-        return optLong(index, 0);
-    }
-
-
-    /**
-     * Get the optional long value associated with an index.
-     * The defaultValue is returned if there is no value for the index,
-     * or if the value is not a number and cannot be converted to a number.
-     * @param index The index must be between 0 and length() - 1.
-     * @param defaultValue     The default value.
-     * @return      The value.
-     */
-    public long optLong(int index, long defaultValue) {
-        try {
-            return getLong(index);
-        } catch (Exception e) {
-            return defaultValue;
-        }
-    }
-
-
-    /**
-     * Get the optional string value associated with an index. It returns an
-     * empty string if there is no value at that index. If the value
-     * is not a string and is not null, then it is coverted to a string.
-     *
-     * @param index The index must be between 0 and length() - 1.
-     * @return      A String value.
-     */
-    public String optString(int index) {
-        return optString(index, "");
-    }
-
-
-    /**
-     * Get the optional string associated with an index.
-     * The defaultValue is returned if the key is not found.
-     *
-     * @param index The index must be between 0 and length() - 1.
-     * @param defaultValue     The default value.
-     * @return      A String value.
-     */
-    public String optString(int index, String defaultValue) {
-        Object o = opt(index);
-        return o != null ? o.toString() : defaultValue;
-    }
-
-
-    /**
-     * Append a boolean value. This increases the array's length by one.
-     *
-     * @param value A boolean value.
-     * @return this.
-     */
-    public JSONArray put(boolean value) {
-        put(value ? Boolean.TRUE : Boolean.FALSE);
-        return this;
-    }
-
-
-    /**
-     * Put a value in the JSONArray, where the value will be a
-     * JSONArray which is produced from a Collection.
-     * @param value	A Collection value.
-     * @return		this.
-     */
-    public JSONArray put(Collection value) {
-        put(new JSONArray(value));
-        return this;
-    }
-
-
-    /**
-     * Append a double value. This increases the array's length by one.
-     *
-     * @param value A double value.
-     * @throws JSONException if the value is not finite.
-     * @return this.
-     */
-    public JSONArray put(double value) throws JSONException {
-        Double d = new Double(value);
-        JSONObject.testValidity(d);
-        put(d);
-        return this;
-    }
-
-
-    /**
-     * Append an int value. This increases the array's length by one.
-     *
-     * @param value An int value.
-     * @return this.
-     */
-    public JSONArray put(int value) {
-        put(new Integer(value));
-        return this;
-    }
-
-
-    /**
-     * Append an long value. This increases the array's length by one.
-     *
-     * @param value A long value.
-     * @return this.
-     */
-    public JSONArray put(long value) {
-        put(new Long(value));
-        return this;
-    }
-
-
-    /**
-     * Put a value in the JSONArray, where the value will be a
-     * JSONObject which is produced from a Map.
-     * @param value	A Map value.
-     * @return		this.
-     */
-    public JSONArray put(Map value) {
-        put(new JSONObject(value));
-        return this;
-    }
-
-
-    /**
-     * Append an object value. This increases the array's length by one.
-     * @param value An object value.  The value should be a
-     *  Boolean, Double, Integer, JSONArray, JSONObject, Long, or String, or the
-     *  JSONObject.NULL object.
-     * @return this.
-     */
-    public JSONArray put(Object value) {
-        this.myArrayList.add(value);
-        return this;
-    }
-
-
-    /**
-     * Put or replace a boolean value in the JSONArray. If the index is greater
-     * than the length of the JSONArray, then null elements will be added as
-     * necessary to pad it out.
-     * @param index The subscript.
-     * @param value A boolean value.
-     * @return this.
-     * @throws JSONException If the index is negative.
-     */
-    public JSONArray put(int index, boolean value) throws JSONException {
-        put(index, value ? Boolean.TRUE : Boolean.FALSE);
-        return this;
-    }
-
-
-    /**
-     * Put a value in the JSONArray, where the value will be a
-     * JSONArray which is produced from a Collection.
-     * @param index The subscript.
-     * @param value	A Collection value.
-     * @return		this.
-     * @throws JSONException If the index is negative or if the value is
-     * not finite.
-     */
-    public JSONArray put(int index, Collection value) throws JSONException {
-        put(index, new JSONArray(value));
-        return this;
-    }
-
-
-    /**
-     * Put or replace a double value. If the index is greater than the length of
-     *  the JSONArray, then null elements will be added as necessary to pad
-     *  it out.
-     * @param index The subscript.
-     * @param value A double value.
-     * @return this.
-     * @throws JSONException If the index is negative or if the value is
-     * not finite.
-     */
-    public JSONArray put(int index, double value) throws JSONException {
-        put(index, new Double(value));
-        return this;
-    }
-
-
-    /**
-     * Put or replace an int value. If the index is greater than the length of
-     *  the JSONArray, then null elements will be added as necessary to pad
-     *  it out.
-     * @param index The subscript.
-     * @param value An int value.
-     * @return this.
-     * @throws JSONException If the index is negative.
-     */
-    public JSONArray put(int index, int value) throws JSONException {
-        put(index, new Integer(value));
-        return this;
-    }
-
-
-    /**
-     * Put or replace a long value. If the index is greater than the length of
-     *  the JSONArray, then null elements will be added as necessary to pad
-     *  it out.
-     * @param index The subscript.
-     * @param value A long value.
-     * @return this.
-     * @throws JSONException If the index is negative.
-     */
-    public JSONArray put(int index, long value) throws JSONException {
-        put(index, new Long(value));
-        return this;
-    }
-
-
-    /**
-     * Put a value in the JSONArray, where the value will be a
-     * JSONObject which is produced from a Map.
-     * @param index The subscript.
-     * @param value	The Map value.
-     * @return		this.
-     * @throws JSONException If the index is negative or if the the value is
-     *  an invalid number.
-     */
-    public JSONArray put(int index, Map value) throws JSONException {
-        put(index, new JSONObject(value));
-        return this;
-    }
-
-
-    /**
-     * Put or replace an object value in the JSONArray. If the index is greater
-     *  than the length of the JSONArray, then null elements will be added as
-     *  necessary to pad it out.
-     * @param index The subscript.
-     * @param value The value to put into the array. The value should be a
-     *  Boolean, Double, Integer, JSONArray, JSONObject, Long, or String, or the
-     *  JSONObject.NULL object.
-     * @return this.
-     * @throws JSONException If the index is negative or if the the value is
-     *  an invalid number.
-     */
-    public JSONArray put(int index, Object value) throws JSONException {
-        JSONObject.testValidity(value);
-        if (index < 0) {
-            throw new JSONException("JSONArray[" + index + "] not found.");
-        }
-        if (index < length()) {
-            this.myArrayList.set(index, value);
-        } else {
-            while (index != length()) {
-                put(JSONObject.NULL);
-            }
-            put(value);
-        }
-        return this;
-    }
-    
-    public JSONArray putIndex(int index, Object value) throws JSONException {
-        JSONObject.testValidity(value);
-        this.myArrayList.add(index, value);
-        return this;
-    }
-
-
-    /**
-     * Produce a JSONObject by combining a JSONArray of names with the values
-     * of this JSONArray.
-     * @param names A JSONArray containing a list of key strings. These will be
-     * paired with the values.
-     * @return A JSONObject, or null if there are no names or if this JSONArray
-     * has no values.
-     * @throws JSONException If any of the names are null.
-     */
-    public JSONObject toJSONObject(JSONArray names) throws JSONException {
-        if (names == null || names.length() == 0 || length() == 0) {
-            return null;
-        }
-        JSONObject jo = new JSONObject();
-        for (int i = 0; i < names.length(); i += 1) {
-            jo.put(names.getString(i), this.opt(i));
-        }
-        return jo;
-    }
-
-
-    /**
-     * Make a JSON text of this JSONArray. For compactness, no
-     * unnecessary whitespace is added. If it is not possible to produce a
-     * syntactically correct JSON text then null will be returned instead. This
-     * could occur if the array contains an invalid number.
-     * <p>
-     * Warning: This method assumes that the data structure is acyclical.
-     *
-     * @return a printable, displayable, transmittable
-     *  representation of the array.
-     */
-    public String toString() {
-        try {
-            return '[' + join(",") + ']';
-        } catch (Exception e) {
-            return null;
-        }
-    }
-
-
-    /**
-     * Make a prettyprinted JSON text of this JSONArray.
-     * Warning: This method assumes that the data structure is acyclical.
-     * @param indentFactor The number of spaces to add to each level of
-     *  indentation.
-     * @return a printable, displayable, transmittable
-     *  representation of the object, beginning
-     *  with <code>[</code>&nbsp;<small>(left bracket)</small> and ending
-     *  with <code>]</code>&nbsp;<small>(right bracket)</small>.
-     * @throws JSONException
-     */
-    public String toString(int indentFactor) throws JSONException {
-        return toString(indentFactor, 0);
-    }
-
-
-    /**
-     * Make a prettyprinted JSON text of this JSONArray.
-     * Warning: This method assumes that the data structure is acyclical.
-     * @param indentFactor The number of spaces to add to each level of
-     *  indentation.
-     * @param indent The indention of the top level.
-     * @return a printable, displayable, transmittable
-     *  representation of the array.
-     * @throws JSONException
-     */
-    String toString(int indentFactor, int indent) throws JSONException {
-        int len = length();
-        if (len == 0) {
-            return "[]";
-        }
-        int i;
-		StringBuilder sb = new StringBuilder("[");
-        if (len == 1) {
-            sb.append(JSONObject.valueToString(this.myArrayList.get(0),
-                    indentFactor, indent));
-        } else {
-            int newindent = indent + indentFactor;
-            sb.append('\n');
-            for (i = 0; i < len; i += 1) {
-                if (i > 0) {
-                    sb.append(",\n");
-                }
-                for (int j = 0; j < newindent; j += 1) {
-                    sb.append(' ');
-                }
-                sb.append(JSONObject.valueToString(this.myArrayList.get(i),
-                        indentFactor, newindent));
-            }
-            sb.append('\n');
-            for (i = 0; i < indent; i += 1) {
-                sb.append(' ');
-            }
-        }
-        sb.append(']');
-        return sb.toString();
-    }
-
-
-    /**
-     * Write the contents of the JSONArray as JSON text to a writer.
-     * For compactness, no whitespace is added.
-     * <p>
-     * Warning: This method assumes that the data structure is acyclical.
-     *
-     * @return The writer.
-     * @throws JSONException
-     */
-    public Writer write(Writer writer) throws JSONException {
-        try {
-            boolean b = false;
-            int     len = length();
-
-            writer.write('[');
-
-            for (int i = 0; i < len; i += 1) {
-                if (b) {
-                    writer.write(',');
-                }
-                Object v = this.myArrayList.get(i);
-                if (v instanceof JSONObject) {
-                    ((JSONObject)v).write(writer);
-                } else if (v instanceof JSONArray) {
-                    ((JSONArray)v).write(writer);
-                } else {
-                    writer.write(JSONObject.valueToString(v));
-                }
-                b = true;
-            }
-            writer.write(']');
-            return writer;
-        } catch (IOException e) {
-           throw new JSONException(e);
-        }
-    }
-	
-	public Iterator iterator(){
-		return this.myArrayList.iterator();
-	}
-}
diff --git a/common/src/main/java/json/org/json/JSONException.java b/common/src/main/java/json/org/json/JSONException.java
deleted file mode 100644
index 60fbe6cf6..000000000
--- a/common/src/main/java/json/org/json/JSONException.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package json.org.json;
-
-/**
- * The JSONException is thrown by the JSON.org classes then things are amiss.
- * @author JSON.org
- * @version 2
- */
-public class JSONException extends Exception {
-    private Throwable cause;
-
-    /**
-     * Constructs a JSONException with an explanatory message.
-     * @param message Detail about the reason for the exception.
-     */
-    public JSONException(String message) {
-        super(message);
-    }
-
-    public JSONException(Throwable t) {
-        super(t.getMessage());
-        this.cause = t;
-    }
-
-    public Throwable getCause() {
-        return this.cause;
-    }
-}
diff --git a/common/src/main/java/json/org/json/JSONObject.java b/common/src/main/java/json/org/json/JSONObject.java
deleted file mode 100644
index 7f1eb9d0e..000000000
--- a/common/src/main/java/json/org/json/JSONObject.java
+++ /dev/null
@@ -1,1279 +0,0 @@
-package json.org.json;
-
-/*
-Copyright (c) 2002 JSON.org
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-The Software shall be used for Good, not Evil.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-*/
-
-import java.util.Collection;
-import java.lang.reflect.Field;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.io.IOException;
-import java.io.Writer;
-import java.util.ArrayList;
-
-/**
- * A JSONObject is an unordered collection of name/value pairs. Its
- * external form is a string wrapped in curly braces with colons between the
- * names and values, and commas between the values and names. The internal form
- * is an object having <code>get</code> and <code>opt</code> methods for
- * accessing the values by name, and <code>put</code> methods for adding or
- * replacing values by name. The values can be any of these types:
- * <code>Boolean</code>, <code>JSONArray</code>, <code>JSONObject</code>,
- * <code>Number</code>, <code>String</code>, or the <code>JSONObject.NULL</code>
- * object. A JSONObject constructor can be used to convert an external form
- * JSON text into an internal form whose values can be retrieved with the
- * <code>get</code> and <code>opt</code> methods, or to convert values into a
- * JSON text using the <code>put</code> and <code>toString</code> methods.
- * A <code>get</code> method returns a value if one can be found, and throws an
- * exception if one cannot be found. An <code>opt</code> method returns a
- * default value instead of throwing an exception, and so is useful for
- * obtaining optional values.
- * <p>
- * The generic <code>get()</code> and <code>opt()</code> methods return an
- * object, which you can cast or query for type. There are also typed
- * <code>get</code> and <code>opt</code> methods that do type checking and type
- * coersion for you.
- * <p>
- * The <code>put</code> methods adds values to an object. For example, <pre>
- *     myString = new JSONObject().put("JSON", "Hello, World!").toString();</pre>
- * produces the string <code>{"JSON": "Hello, World"}</code>.
- * <p>
- * The texts produced by the <code>toString</code> methods strictly conform to
- * the JSON sysntax rules.
- * The constructors are more forgiving in the texts they will accept:
- * <ul>
- * <li>An extra <code>,</code>&nbsp;<small>(comma)</small> may appear just
- *     before the closing brace.</li>
- * <li>Strings may be quoted with <code>'</code>&nbsp;<small>(single
- *     quote)</small>.</li>
- * <li>Strings do not need to be quoted at all if they do not begin with a quote
- *     or single quote, and if they do not contain leading or trailing spaces,
- *     and if they do not contain any of these characters:
- *     <code>{ } [ ] / \ : , = ; #</code> and if they do not look like numbers
- *     and if they are not the reserved words <code>true</code>,
- *     <code>false</code>, or <code>null</code>.</li>
- * <li>Keys can be followed by <code>=</code> or <code>=></code> as well as
- *     by <code>:</code>.</li>
- * <li>Values can be followed by <code>;</code> <small>(semicolon)</small> as
- *     well as by <code>,</code> <small>(comma)</small>.</li>
- * <li>Numbers may have the <code>0-</code> <small>(octal)</small> or
- *     <code>0x-</code> <small>(hex)</small> prefix.</li>
- * <li>Comments written in the slashshlash, slashstar, and hash conventions
- *     will be ignored.</li>
- * </ul>
- * @author JSON.org
- * @version 2
- */
-public class JSONObject implements IJsonFormattable, java.io.Serializable{
-
-    /**
-     * JSONObject.NULL is equivalent to the value that JavaScript calls null,
-     * whilst Java's null is equivalent to the value that JavaScript calls
-     * undefined.
-     */
-     private static final class Null {
-
-        /**
-         * There is only intended to be a single instance of the NULL object,
-         * so the clone method returns itself.
-         * @return     NULL.
-         */
-        protected final Object clone() {
-            return this;
-        }
-
-
-        /**
-         * A Null object is equal to the null value and to itself.
-         * @param object    An object to test for nullness.
-         * @return true if the object parameter is the JSONObject.NULL object
-         *  or null.
-         */
-        public boolean equals(Object object) {
-            return object == null || object == this;
-        }
-
-
-        /**
-         * Get the "null" string value.
-         * @return The string "null".
-         */
-        public String toString() {
-            return "null";
-        }
-    }
-
-
-    /**
-     * The hash map where the JSONObject's properties are kept.
-     */
-    private HashMap<String, Object> myHashMap;
-	private ArrayList<String> nameIndexList;
-
-    /**
-     * It is sometimes more convenient and less ambiguous to have a
-     * <code>NULL</code> object than to use Java's <code>null</code> value.
-     * <code>JSONObject.NULL.equals(null)</code> returns <code>true</code>.
-     * <code>JSONObject.NULL.toString()</code> returns <code>"null"</code>.
-     */
-    public static final Object NULL = new Null();
-
-
-    /**
-     * Construct an empty JSONObject.
-     */
-    public JSONObject() {
-        this.myHashMap = new HashMap<>();
-		this.nameIndexList = new ArrayList<>();
-    }
-
-
-    /**
-     * Construct a JSONObject from a subset of another JSONObject.
-     * An array of strings is used to identify the keys that should be copied.
-     * Missing keys are ignored.
-     * @param jo A JSONObject.
-     * @param sa An array of strings.
-     * @exception JSONException If a value is a non-finite number.
-     */
-    public JSONObject(JSONObject jo, String[] sa) throws JSONException {
-        this();
-        for (int i = 0; i < sa.length; i += 1) {
-            putOpt(sa[i], jo.opt(sa[i]));
-        }
-    }
-
-
-    /**
-     * Construct a JSONObject from a JSONTokener.
-     * @param x A JSONTokener object containing the source string.
-     * @throws JSONException If there is a syntax error in the source string.
-     */
-    public JSONObject(JSONTokener x) throws JSONException {
-        this();
-        char c;
-        String key;
-
-        if (x.nextClean() != '{') {
-            throw x.syntaxError("A JSONObject text must begin with '{'");
-        }
-        for (;;) {
-            c = x.nextClean();
-            switch (c) {
-            case 0:
-                throw x.syntaxError("A JSONObject text must end with '}'");
-            case '}':
-                return;
-            default:
-                x.back();
-                key = x.nextValue().toString();
-            }
-
-            /*
-             * The key is followed by ':'. We will also tolerate '=' or '=>'.
-             */
-
-            c = x.nextClean();
-            if (c == '=') {
-                if (x.next() != '>') {
-                    x.back();
-                }
-            } else if (c != ':') {
-                throw x.syntaxError("Expected a ':' after a key");
-            }
-            put(key, x.nextValue());
-
-            /*
-             * Pairs are separated by ','. We will also tolerate ';'.
-             */
-
-            switch (x.nextClean()) {
-            case ';':
-            case ',':
-                if (x.nextClean() == '}') {
-                    return;
-                }
-                x.back();
-                break;
-            case '}':
-                return;
-            default:
-                throw x.syntaxError("Expected a ',' or '}'");
-            }
-        }
-    }
-
-
-    /**
-     * Construct a JSONObject from a Map.
-     * @param map A map object that can be used to initialize the contents of
-     *  the JSONObject.
-     */
-	@SuppressWarnings("unchecked")
-    public JSONObject(Map map) {
-        this.myHashMap = (map == null) ?
-        	new HashMap<>() :
-        	new HashMap<>(map);
-		this.nameIndexList = (map == null) ?
-			new ArrayList<>():
-			new ArrayList<>(map.keySet());
-    }
-
-
-    /**
-     * Construct a JSONObject from an Object, using reflection to find the
-     * public members. The resulting JSONObject's keys will be the strings
-     * from the names array, and the values will be the field values associated
-     * with those keys in the object. If a key is not found or not visible,
-     * then it will not be copied into the new JSONObject.
-     * @param object An object that has fields that should be used to make a
-     * JSONObject.
-     * @param names An array of strings, the names of the fields to be used
-     * from the object.
-     */
-    public JSONObject(Object object, String names[]) {
-    	this();
-    	Class c = object.getClass();
-    	for (int i = 0; i < names.length; i += 1) {
-    		try {
-    			String name = names[i];
-    			Field field = c.getField(name);
-    			Object value = field.get(object);
-	    		this.put(name, value);
-    		} catch (Exception e) {
-    			/* forget about it */
-    		}
-    	}
-    }
-
-
-    /**
-     * Construct a JSONObject from a string.
-     * This is the most commonly used JSONObject constructor.
-     * @param string    A string beginning
-     *  with <code>{</code>&nbsp;<small>(left brace)</small> and ending
-     *  with <code>}</code>&nbsp;<small>(right brace)</small>.
-     * @exception JSONException If there is a syntax error in the source string.
-     */
-    public JSONObject(String string) throws JSONException {
-        this(new JSONTokener(string));
-    }
-
-
-    /**
-     * Accumulate values under a key. It is similar to the put method except
-     * that if there is already an object stored under the key then a
-     * JSONArray is stored under the key to hold all of the accumulated values.
-     * If there is already a JSONArray, then the new value is appended to it.
-     * In contrast, the put method replaces the previous value.
-     * @param key   A key string.
-     * @param value An object to be accumulated under the key.
-     * @return this.
-     * @throws JSONException If the value is an invalid number
-     *  or if the key is null.
-     */
-    public JSONObject accumulate(String key, Object value)
-            throws JSONException {
-        testValidity(value);
-        Object o = opt(key);
-        if (o == null) {
-            put(key, value);
-        } else if (o instanceof JSONArray) {
-            ((JSONArray)o).put(value);
-        } else {
-            put(key, new JSONArray().put(o).put(value));
-        }
-        return this;
-    }
-
-
-    /**
-     * Append values to the array under a key. If the key does not exist in the
-     * JSONObject, then the key is put in the JSONObject with its value being a
-     * JSONArray containing the value parameter. If the key was already
-     * associated with a JSONArray, then the value parameter is appended to it.
-     * @param key   A key string.
-     * @param value An object to be accumulated under the key.
-     * @return this.
-     * @throws JSONException If the key is null or if the current value
-     * 	associated with the key is not a JSONArray.
-     */
-    public JSONObject append(String key, Object value)
-            throws JSONException {
-        testValidity(value);
-        Object o = opt(key);
-        if (o == null) {
-            put(key, new JSONArray().put(value));
-        } else if (o instanceof JSONArray) {
-            throw new JSONException("JSONObject[" + key +
-            		"] is not a JSONArray.");
-        } else {
-            put(key, new JSONArray().put(o).put(value));
-        }
-        return this;
-    }
-
-
-    /**
-     * Produce a string from a double. The string "null" will be returned if
-     * the number is not finite.
-     * @param  d A double.
-     * @return A String.
-     */
-    static public String doubleToString(double d) {
-        if (Double.isInfinite(d) || Double.isNaN(d)) {
-        	return "null";
-        }
-
-// Shave off trailing zeros and decimal point, if possible.
-
-        String s = Double.toString(d);
-        if (s.indexOf('.') > 0 && s.indexOf('e') < 0 && s.indexOf('E') < 0) {
-            while (s.endsWith("0")) {
-                s = s.substring(0, s.length() - 1);
-            }
-            if (s.endsWith(".")) {
-                s = s.substring(0, s.length() - 1);
-            }
-        }
-        return s;
-    }
-
-
-    /**
-     * Get the value object associated with a key.
-     *
-     * @param key   A key string.
-     * @return      The object associated with the key.
-     * @throws   JSONException if the key is not found.
-     */
-    public Object get(String key) throws JSONException {
-        Object o = opt(key);
-        if (o == null) {
-            throw new JSONException("JSONObject[" + quote(key) +
-                    "] not found.");
-        }
-        return o;
-    }
-
-
-    /**
-     * Get the boolean value associated with a key.
-     *
-     * @param key   A key string.
-     * @return      The truth.
-     * @throws   JSONException
-     *  if the value is not a Boolean or the String "true" or "false".
-     */
-    public boolean getBoolean(String key) throws JSONException {
-        Object o = get(key);
-        if (o.equals(Boolean.FALSE) ||
-                (o instanceof String &&
-                ((String)o).equalsIgnoreCase("false"))) {
-            return false;
-        } else if (o.equals(Boolean.TRUE) ||
-                (o instanceof String &&
-                ((String)o).equalsIgnoreCase("true"))) {
-            return true;
-        }
-        throw new JSONException("JSONObject[" + quote(key) +
-                "] is not a Boolean.");
-    }
-
-
-    /**
-     * Get the double value associated with a key.
-     * @param key   A key string.
-     * @return      The numeric value.
-     * @throws JSONException if the key is not found or
-     *  if the value is not a Number object and cannot be converted to a number.
-     */
-    public double getDouble(String key) throws JSONException {
-        Object o = get(key);
-        try {
-            return o instanceof Number ?
-                ((Number)o).doubleValue() :
-                Double.valueOf((String)o).doubleValue();
-        } catch (Exception e) {
-            throw new JSONException("JSONObject[" + quote(key) +
-                "] is not a number.");
-        }
-    }
-
-
-    /**
-     * Get the int value associated with a key. If the number value is too
-     * large for an int, it will be clipped.
-     *
-     * @param key   A key string.
-     * @return      The integer value.
-     * @throws   JSONException if the key is not found or if the value cannot
-     *  be converted to an integer.
-     */
-    public int getInt(String key) throws JSONException {
-        Object o = get(key);
-        return o instanceof Number ?
-                ((Number)o).intValue() : (int)getDouble(key);
-    }
-
-
-    /**
-     * Get the JSONArray value associated with a key.
-     *
-     * @param key   A key string.
-     * @return      A JSONArray which is the value.
-     * @throws   JSONException if the key is not found or
-     *  if the value is not a JSONArray.
-     */
-    public JSONArray getJSONArray(String key) throws JSONException {
-        Object o = get(key);
-        if (o instanceof JSONArray) {
-            return (JSONArray)o;
-        }
-        throw new JSONException("JSONObject[" + quote(key) +
-                "] is not a JSONArray.");
-    }
-
-
-    /**
-     * Get the JSONObject value associated with a key.
-     *
-     * @param key   A key string.
-     * @return      A JSONObject which is the value.
-     * @throws   JSONException if the key is not found or
-     *  if the value is not a JSONObject.
-     */
-    public JSONObject getJSONObject(String key) throws JSONException {
-        Object o = get(key);
-        if (o instanceof JSONObject) {
-            return (JSONObject)o;
-        }
-        throw new JSONException("JSONObject[" + quote(key) +
-                "] is not a JSONObject.");
-    }
-
-
-    /**
-     * Get the long value associated with a key. If the number value is too
-     * long for a long, it will be clipped.
-     *
-     * @param key   A key string.
-     * @return      The long value.
-     * @throws   JSONException if the key is not found or if the value cannot
-     *  be converted to a long.
-     */
-    public long getLong(String key) throws JSONException {
-        Object o = get(key);
-        return o instanceof Number ?
-                ((Number)o).longValue() : (long)getDouble(key);
-    }
-
-
-    /**
-     * Get the string associated with a key.
-     *
-     * @param key   A key string.
-     * @return      A string which is the value.
-     * @throws   JSONException if the key is not found.
-     */
-    public String getString(String key) throws JSONException {
-        return get(key).toString();
-    }
-
-
-    /**
-     * Determine if the JSONObject contains a specific key.
-     * @param key   A key string.
-     * @return      true if the key exists in the JSONObject.
-     */
-    public boolean has(String key) {
-        return this.myHashMap.containsKey(key);
-    }
-
-
-    /**
-     * Determine if the value associated with the key is null or if there is
-     *  no value.
-     * @param key   A key string.
-     * @return      true if there is no value associated with the key or if
-     *  the value is the JSONObject.NULL object.
-     */
-    public boolean isNull(String key) {
-        return JSONObject.NULL.equals(opt(key));
-    }
-
-
-    /**
-     * Get an enumeration of the keys of the JSONObject.
-     *
-     * @return An iterator of the keys.
-     */
-    public Iterator<String> keys() {
-		return this.nameIndexList.iterator();
-    }
-
-
-    /**
-     * Get the number of keys stored in the JSONObject.
-     *
-     * @return The number of keys in the JSONObject.
-     */
-    public int length() {
-        return this.myHashMap.size();
-    }
-
-    /**
-     * Clears all keys and values stored in the JSONObject.
-     *
-     */
-    public void clear() {
-        this.myHashMap.clear();
-		this.nameIndexList.clear();
-    }
-
-
-    /**
-     * Produce a JSONArray containing the names of the elements of this
-     * JSONObject.
-     * @return A JSONArray containing the key strings, or null if the JSONObject
-     * is empty.
-     */
-    public JSONArray names() {
-        JSONArray ja = new JSONArray();
-        Iterator  keys = keys();
-        while (keys.hasNext()) {
-            ja.put(keys.next());
-        }
-        return ja.length() == 0 ? null : ja;
-    }
-
-    /**
-     * Produce a string from a Number.
-     * @param  n A Number
-     * @return A String.
-     * @throws JSONException If n is a non-finite number.
-     */
-    static public String numberToString(Number n)
-            throws JSONException {
-        if (n == null) {
-            throw new JSONException("Null pointer");
-        }
-        testValidity(n);
-
-// Shave off trailing zeros and decimal point, if possible.
-
-        String s = n.toString();
-        if (s.indexOf('.') > 0 && s.indexOf('e') < 0 && s.indexOf('E') < 0) {
-            while (s.endsWith("0")) {
-                s = s.substring(0, s.length() - 1);
-            }
-            if (s.endsWith(".")) {
-                s = s.substring(0, s.length() - 1);
-            }
-        }
-        return s;
-    }
-
-    public static IExtensionJSONObject extension;
-    
-    static public String dateToString(java.util.Date d)
-            throws JSONException {
-        return extension.dateToString(d);
-    }
-
-    /**
-     * Get an optional value associated with a key.
-     * @param key   A key string.
-     * @return      An object which is the value, or null if there is no value.
-     */
-    public Object opt(String key) {
-        return key == null ? null : this.myHashMap.get(key);
-    }
-
-
-    /**
-     * Get an optional boolean associated with a key.
-     * It returns false if there is no such key, or if the value is not
-     * Boolean.TRUE or the String "true".
-     *
-     * @param key   A key string.
-     * @return      The truth.
-     */
-    public boolean optBoolean(String key) {
-        return optBoolean(key, false);
-    }
-
-
-    /**
-     * Get an optional boolean associated with a key.
-     * It returns the defaultValue if there is no such key, or if it is not
-     * a Boolean or the String "true" or "false" (case insensitive).
-     *
-     * @param key              A key string.
-     * @param defaultValue     The default.
-     * @return      The truth.
-     */
-    public boolean optBoolean(String key, boolean defaultValue) {
-        try {
-            return getBoolean(key);
-        } catch (Exception e) {
-            return defaultValue;
-        }
-    }
-
-
-    /**
-     * Put a key/value pair in the JSONObject, where the value will be a
-     * JSONArray which is produced from a Collection.
-     * @param key 	A key string.
-     * @param value	A Collection value.
-     * @return		this.
-     * @throws JSONException
-     */
-    public JSONObject put(String key, Collection value) throws JSONException {
-        put(key, new JSONArray(value));
-        return this;
-    }
-
-
-    /**
-     * Get an optional double associated with a key,
-     * or NaN if there is no such key or if its value is not a number.
-     * If the value is a string, an attempt will be made to evaluate it as
-     * a number.
-     *
-     * @param key   A string which is the key.
-     * @return      An object which is the value.
-     */
-    public double optDouble(String key) {
-        return optDouble(key, Double.NaN);
-    }
-
-
-    /**
-     * Get an optional double associated with a key, or the
-     * defaultValue if there is no such key or if its value is not a number.
-     * If the value is a string, an attempt will be made to evaluate it as
-     * a number.
-     *
-     * @param key   A key string.
-     * @param defaultValue     The default.
-     * @return      An object which is the value.
-     */
-    public double optDouble(String key, double defaultValue) {
-        try {
-            Object o = opt(key);
-            return o instanceof Number ? ((Number)o).doubleValue() :
-                new Double((String)o).doubleValue();
-        } catch (Exception e) {
-            return defaultValue;
-        }
-    }
-
-
-    /**
-     * Get an optional int value associated with a key,
-     * or zero if there is no such key or if the value is not a number.
-     * If the value is a string, an attempt will be made to evaluate it as
-     * a number.
-     *
-     * @param key   A key string.
-     * @return      An object which is the value.
-     */
-    public int optInt(String key) {
-        return optInt(key, 0);
-    }
-
-
-    /**
-     * Get an optional int value associated with a key,
-     * or the default if there is no such key or if the value is not a number.
-     * If the value is a string, an attempt will be made to evaluate it as
-     * a number.
-     *
-     * @param key   A key string.
-     * @param defaultValue     The default.
-     * @return      An object which is the value.
-     */
-    public int optInt(String key, int defaultValue) {
-        try {
-            return getInt(key);
-        } catch (Exception e) {
-            return defaultValue;
-        }
-    }
-
-
-    /**
-     * Get an optional JSONArray associated with a key.
-     * It returns null if there is no such key, or if its value is not a
-     * JSONArray.
-     *
-     * @param key   A key string.
-     * @return      A JSONArray which is the value.
-     */
-    public JSONArray optJSONArray(String key) {
-        Object o = opt(key);
-        return o instanceof JSONArray ? (JSONArray)o : null;
-    }
-
-
-    /**
-     * Get an optional JSONObject associated with a key.
-     * It returns null if there is no such key, or if its value is not a
-     * JSONObject.
-     *
-     * @param key   A key string.
-     * @return      A JSONObject which is the value.
-     */
-    public JSONObject optJSONObject(String key) {
-        Object o = opt(key);
-        return o instanceof JSONObject ? (JSONObject)o : null;
-    }
-
-
-    /**
-     * Get an optional long value associated with a key,
-     * or zero if there is no such key or if the value is not a number.
-     * If the value is a string, an attempt will be made to evaluate it as
-     * a number.
-     *
-     * @param key   A key string.
-     * @return      An object which is the value.
-     */
-    public long optLong(String key) {
-        return optLong(key, 0);
-    }
-
-
-    /**
-     * Get an optional long value associated with a key,
-     * or the default if there is no such key or if the value is not a number.
-     * If the value is a string, an attempt will be made to evaluate it as
-     * a number.
-     *
-     * @param key   A key string.
-     * @param defaultValue     The default.
-     * @return      An object which is the value.
-     */
-    public long optLong(String key, long defaultValue) {
-        try {
-            return getLong(key);
-        } catch (Exception e) {
-            return defaultValue;
-        }
-    }
-
-
-    /**
-     * Get an optional string associated with a key.
-     * It returns an empty string if there is no such key. If the value is not
-     * a string and is not null, then it is coverted to a string.
-     *
-     * @param key   A key string.
-     * @return      A string which is the value.
-     */
-    public String optString(String key) {
-        return optString(key, "");
-    }
-
-
-    /**
-     * Get an optional string associated with a key.
-     * It returns the defaultValue if there is no such key.
-     *
-     * @param key   A key string.
-     * @param defaultValue     The default.
-     * @return      A string which is the value.
-     */
-    public String optString(String key, String defaultValue) {
-        Object o = opt(key);
-        return o != null ? o.toString() : defaultValue;
-    }
-
-
-    /**
-     * Put a key/boolean pair in the JSONObject.
-     *
-     * @param key   A key string.
-     * @param value A boolean which is the value.
-     * @return this.
-     * @throws JSONException If the key is null.
-     */
-    public JSONObject put(String key, boolean value) throws JSONException {
-        put(key, value ? Boolean.TRUE : Boolean.FALSE);
-        return this;
-    }
-
-
-    /**
-     * Put a key/double pair in the JSONObject.
-     *
-     * @param key   A key string.
-     * @param value A double which is the value.
-     * @return this.
-     * @throws JSONException If the key is null or if the number is invalid.
-     */
-    public JSONObject put(String key, double value) throws JSONException {
-        put(key, new Double(value));
-        return this;
-    }
-
-
-    /**
-     * Put a key/int pair in the JSONObject.
-     *
-     * @param key   A key string.
-     * @param value An int which is the value.
-     * @return this.
-     * @throws JSONException If the key is null.
-     */
-    public JSONObject put(String key, int value) throws JSONException {
-        put(key, new Integer(value));
-        return this;
-    }
-
-
-    /**
-     * Put a key/long pair in the JSONObject.
-     *
-     * @param key   A key string.
-     * @param value A long which is the value.
-     * @return this.
-     * @throws JSONException If the key is null.
-     */
-    public JSONObject put(String key, long value) throws JSONException {
-        put(key, new Long(value));
-        return this;
-    }
-
-
-    /**
-     * Put a key/value pair in the JSONObject, where the value will be a
-     * JSONObject which is produced from a Map.
-     * @param key 	A key string.
-     * @param value	A Map value.
-     * @return		this.
-     * @throws JSONException
-     */
-    public JSONObject put(String key, Map value) throws JSONException {
-        put(key, new JSONObject(value));
-        return this;
-    }
-
-
-    /**
-     * Put a key/value pair in the JSONObject. If the value is null,
-     * then the key will be removed from the JSONObject if it is present.
-     * @param key   A key string.
-     * @param value An object which is the value. It should be of one of these
-     *  types: Boolean, Double, Integer, JSONArray, JSONObject, Long, String,
-     *  or the JSONObject.NULL object.
-     * @return this.
-     * @throws JSONException If the value is non-finite number
-     *  or if the key is null.
-     */
-    public JSONObject put(String key, Object value) throws JSONException {
-        if (key == null) {
-            throw new JSONException("Null key.");
-        }
-		testValidity(value);
-		if (!has(key)) {
-			this.nameIndexList.add(key);
-		}
-		this.myHashMap.put(key, value);
-        return this;
-    }
-
-
-    /**
-     * Put a key/value pair in the JSONObject, but only if the
-     * key and the value are both non-null.
-     * @param key   A key string.
-     * @param value An object which is the value. It should be of one of these
-     *  types: Boolean, Double, Integer, JSONArray, JSONObject, Long, String,
-     *  or the JSONObject.NULL object.
-     * @return this.
-     * @throws JSONException If the value is a non-finite number.
-     */
-    public JSONObject putOpt(String key, Object value) throws JSONException {
-        if (key != null && value != null) {
-            put(key, value);
-        }
-        return this;
-    }
-
-
-    /**
-     * Produce a string in double quotes with backslash sequences in all the
-     * right places. A backslash will be inserted within </, allowing JSON
-     * text to be delivered in HTML. In JSON text, a string cannot contain a
-     * control character or an unescaped quote or backslash.
-     * @param string A String
-     * @return  A String correctly formatted for insertion in a JSON text.
-     */
-    public static String quote(String string) {
-        if (string == null || string.length() == 0) {
-            return "\"\"";
-        }
-
-        char         b;
-        char         c = 0;
-        int          i;
-        int          len = string.length();
-		StringBuilder sb = new StringBuilder(len + 4);
-        String       t;
-
-        sb.append('"');
-        for (i = 0; i < len; i += 1) {
-            b = c;
-            c = string.charAt(i);
-            switch (c) {
-            case '\\':
-            case '"':
-                sb.append('\\');
-                sb.append(c);
-                break;
-            case '\b':
-                sb.append("\\b");
-                break;
-            case '\t':
-                sb.append("\\t");
-                break;
-            case '\n':
-                sb.append("\\n");
-                break;
-            case '\f':
-                sb.append("\\f");
-                break;
-            case '\r':
-                sb.append("\\r");
-                break;
-            default:
-                if (c < ' ') {
-                    t = "000" + Integer.toHexString(c);
-                    sb.append("\\u" + t.substring(t.length() - 4));
-                } else {
-                    sb.append(c);
-                }
-            }
-        }
-        sb.append('"');
-        return sb.toString();
-    }
-
-    /**
-     * Remove a name and its value, if present.
-     * @param key The name to be removed.
-     * @return The value that was associated with the name,
-     * or null if there was no value.
-     */
-    public Object remove(String key) {
-		if (this.nameIndexList.contains(key))
-			this.nameIndexList.remove(key);
-        return this.myHashMap.remove(key);
-    }
-
-
-    /**
-     * Throw an exception if the object is an NaN or infinite number.
-     * @param o The object to test.
-     * @throws JSONException If o is a non-finite number.
-     */
-    static void testValidity(Object o) throws JSONException {
-        if (o != null) {
-            if (o instanceof Double) {
-                if (((Double)o).isInfinite() || ((Double)o).isNaN()) {
-                    throw new JSONException(
-                        "JSON does not allow non-finite numbers");
-                }
-            } else if (o instanceof Float) {
-                if (((Float)o).isInfinite() || ((Float)o).isNaN()) {
-                    throw new JSONException(
-                        "JSON does not allow non-finite numbers.");
-                }
-            }
-        }
-    }
-
-
-    /**
-     * Produce a JSONArray containing the values of the members of this
-     * JSONObject.
-     * @param names A JSONArray containing a list of key strings. This
-     * determines the sequence of the values in the result.
-     * @return A JSONArray of values.
-     * @throws JSONException If any of the values are non-finite numbers.
-     */
-    public JSONArray toJSONArray(JSONArray names) throws JSONException {
-        if (names == null || names.length() == 0) {
-            return null;
-        }
-        JSONArray ja = new JSONArray();
-        for (int i = 0; i < names.length(); i += 1) {
-            ja.put(this.opt(names.getString(i)));
-        }
-        return ja;
-    }
-
-    /**
-     * Make a JSON text of this JSONObject. For compactness, no whitespace
-     * is added. If this would not result in a syntactically correct JSON text,
-     * then null will be returned instead.
-     * <p>
-     * Warning: This method assumes that the data structure is acyclical.
-     *
-     * @return a printable, displayable, portable, transmittable
-     *  representation of the object, beginning
-     *  with <code>{</code>&nbsp;<small>(left brace)</small> and ending
-     *  with <code>}</code>&nbsp;<small>(right brace)</small>.
-     */
-    public String toString() {
-        try {
-            Iterator     keys = keys();
-			StringBuilder sb = new StringBuilder("{");
-
-            while (keys.hasNext()) {
-                if (sb.length() > 1) {
-                    sb.append(',');
-                }
-                Object o = keys.next();
-                sb.append(quote(o.toString()));
-                sb.append(':');
-                sb.append(valueToString(this.myHashMap.get(o)));
-            }
-            sb.append('}');
-            return sb.toString();
-        } catch (Exception e) {
-            return null;
-        }
-    }
-
-
-    /**
-     * Make a prettyprinted JSON text of this JSONObject.
-     * <p>
-     * Warning: This method assumes that the data structure is acyclical.
-     * @param indentFactor The number of spaces to add to each level of
-     *  indentation.
-     * @return a printable, displayable, portable, transmittable
-     *  representation of the object, beginning
-     *  with <code>{</code>&nbsp;<small>(left brace)</small> and ending
-     *  with <code>}</code>&nbsp;<small>(right brace)</small>.
-     * @throws JSONException If the object contains an invalid number.
-     */
-    public String toString(int indentFactor) throws JSONException {
-        return toString(indentFactor, 0);
-    }
-
-
-    /**
-     * Make a prettyprinted JSON text of this JSONObject.
-     * <p>
-     * Warning: This method assumes that the data structure is acyclical.
-     * @param indentFactor The number of spaces to add to each level of
-     *  indentation.
-     * @param indent The indentation of the top level.
-     * @return a printable, displayable, transmittable
-     *  representation of the object, beginning
-     *  with <code>{</code>&nbsp;<small>(left brace)</small> and ending
-     *  with <code>}</code>&nbsp;<small>(right brace)</small>.
-     * @throws JSONException If the object contains an invalid number.
-     */
-    String toString(int indentFactor, int indent) throws JSONException {
-        int          i;
-        int          n = length();
-        if (n == 0) {
-            return "{}";
-        }
-        Iterator     keys = keys();
-		StringBuilder sb = new StringBuilder("{");
-        int          newindent = indent + indentFactor;
-        Object       o;
-        if (n == 1) {
-            o = keys.next();
-            sb.append(quote(o.toString()));
-            sb.append(": ");
-            sb.append(valueToString(this.myHashMap.get(o), indentFactor,
-                    indent));
-        } else {
-            while (keys.hasNext()) {
-                o = keys.next();
-                if (sb.length() > 1) {
-                    sb.append(",\n");
-                } else {
-                    sb.append('\n');
-                }
-                for (i = 0; i < newindent; i += 1) {
-                    sb.append(' ');
-                }
-                sb.append(quote(o.toString()));
-                sb.append(": ");
-                sb.append(valueToString(this.myHashMap.get(o), indentFactor,
-                        newindent));
-            }
-            if (sb.length() > 1) {
-                sb.append('\n');
-                for (i = 0; i < indent; i += 1) {
-                    sb.append(' ');
-                }
-            }
-        }
-        sb.append('}');
-        return sb.toString();
-    }
-
-
-    /**
-     * Make a JSON text of an Object value. If the object has an
-     * value.toJSONString() method, then that method will be used to produce
-     * the JSON text. The method is required to produce a strictly
-     * conforming text. If the object does not contain a toJSONString
-     * method (which is the most common case), then a text will be
-     * produced by the rules.
-     * <p>
-     * Warning: This method assumes that the data structure is acyclical.
-     * @param value The value to be serialized.
-     * @return a printable, displayable, transmittable
-     *  representation of the object, beginning
-     *  with <code>{</code>&nbsp;<small>(left brace)</small> and ending
-     *  with <code>}</code>&nbsp;<small>(right brace)</small>.
-     * @throws JSONException If the value is or contains an invalid number.
-     */
-    static String valueToString(Object value) throws JSONException {
-        if (value == null) {
-            return "null";
-        }
-        if (value instanceof JSONString) {
-        	Object o;
-        	try {
-            	o = ((JSONString)value).toJSONString();
-            } catch (Exception e) {
-            	throw new JSONException(e);
-            }
-            if (o instanceof String) {
-	        	return (String)o;
-	        }
-            throw new JSONException("Bad value from toJSONString: " + o);
-        }
-        if (value instanceof Number) {
-            return numberToString((Number) value);
-        }
-        if (value instanceof java.util.Date) {
-            return "\"" + dateToString((java.util.Date) value) + "\"";
-        }
-        if (value instanceof Boolean || value instanceof JSONObject ||
-                value instanceof JSONArray) {
-            return value.toString();
-        }
-
-        return quote(value.toString());
-    }
-
-
-    /**
-     * Make a prettyprinted JSON text of an object value.
-     * <p>
-     * Warning: This method assumes that the data structure is acyclical.
-     * @param value The value to be serialized.
-     * @param indentFactor The number of spaces to add to each level of
-     *  indentation.
-     * @param indent The indentation of the top level.
-     * @return a printable, displayable, transmittable
-     *  representation of the object, beginning
-     *  with <code>{</code>&nbsp;<small>(left brace)</small> and ending
-     *  with <code>}</code>&nbsp;<small>(right brace)</small>.
-     * @throws JSONException If the object contains an invalid number.
-     */
-     static String valueToString(Object value, int indentFactor, int indent)
-            throws JSONException {
-        if (value == null) {
-            return "null";
-        }
-        try {
-	        if (value instanceof JSONString) {
-		        Object o = ((JSONString)value).toJSONString();
-		        if (o instanceof String) {
-		        	return (String)o;
-		        }
-	        }
-        } catch (Exception e) {
-        	/* forget about it */
-        }
-        if (value instanceof Number) {
-            return numberToString((Number) value);
-        }
-        if (value instanceof Boolean) {
-            return value.toString();
-        }
-        if (value instanceof JSONObject) {
-            return ((JSONObject)value).toString(indentFactor, indent);
-        }
-        if (value instanceof JSONArray) {
-            return ((JSONArray)value).toString(indentFactor, indent);
-        }
-        return quote(value.toString());
-    }
-
-
-     /**
-      * Write the contents of the JSONObject as JSON text to a writer.
-      * For compactness, no whitespace is added.
-      * <p>
-      * Warning: This method assumes that the data structure is acyclical.
-      *
-      * @return The writer.
-      * @throws JSONException
-      */
-     public Writer write(Writer writer) throws JSONException {
-        try {
-            boolean  b = false;
-            Iterator keys = keys();
-            writer.write('{');
-
-            while (keys.hasNext()) {
-                if (b) {
-                    writer.write(',');
-                }
-                Object k = keys.next();
-                writer.write(quote(k.toString()));
-                writer.write(':');
-                Object v = this.myHashMap.get(k);
-                if (v instanceof JSONObject) {
-                    ((JSONObject)v).write(writer);
-                } else if (v instanceof JSONArray) {
-                    ((JSONArray)v).write(writer);
-                } else {
-                    writer.write(valueToString(v));
-                }
-                b = true;
-            }
-            writer.write('}');
-            return writer;
-        } catch (IOException e) {
-            throw new JSONException(e);
-        }
-     }
-}
diff --git a/common/src/main/java/json/org/json/JSONString.java b/common/src/main/java/json/org/json/JSONString.java
deleted file mode 100644
index e26a36d63..000000000
--- a/common/src/main/java/json/org/json/JSONString.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package json.org.json;
-/**
- * The <code>JSONString</code> interface allows a <code>toJSONString()</code>
- * method so that a class can change the behavior of
- * <code>JSONObject.toString()</code>, <code>JSONArray.toString()</code>,
- * and <code>JSONWriter.value(</code>Object<code>)</code>. The
- * <code>toJSONString</code> method will be used instead of the default behavior
- * of using the Object's <code>toString()</code> method and quoting the result.
- */
-public interface JSONString {
-	/**
-	 * The <code>toJSONString</code> method allows a class to produce its own JSON
-	 * serialization.
-	 *
-	 * @return A strictly syntactically correct JSON text.
-	 */
-	public String toJSONString();
-}
diff --git a/common/src/main/java/json/org/json/JSONStringer.java b/common/src/main/java/json/org/json/JSONStringer.java
deleted file mode 100644
index 0a79ce74a..000000000
--- a/common/src/main/java/json/org/json/JSONStringer.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package json.org.json;
-
-/*
-Copyright (c) 2006 JSON.org
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-The Software shall be used for Good, not Evil.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-*/
-
-import java.io.StringWriter;
-
-/**
- * JSONStringer provides a quick and convenient way of producing JSON text.
- * The texts produced strictly conform to JSON syntax rules. No whitespace is
- * added, so the results are ready for transmission or storage. Each instance of
- * JSONStringer can produce one JSON text.
- * <p>
- * A JSONStringer instance provides a <code>value</code> method for appending
- * values to the
- * text, and a <code>key</code>
- * method for adding keys before values in objects. There are <code>array</code>
- * and <code>endArray</code> methods that make and bound array values, and
- * <code>object</code> and <code>endObject</code> methods which make and bound
- * object values. All of these methods return the JSONWriter instance,
- * permitting cascade style. For example, <pre>
- * myString = new JSONStringer()
- *     .object()
- *         .key("JSON")
- *         .value("Hello, World!")
- *     .endObject()
- *     .toString();</pre> which produces the string <pre>
- * {"JSON":"Hello, World!"}</pre>
- * <p>
- * The first method called must be <code>array</code> or <code>object</code>.
- * There are no methods for adding commas or colons. JSONStringer adds them for
- * you. Objects and arrays can be nested up to 20 levels deep.
- * <p>
- * This can sometimes be easier than using a JSONObject to build a string.
- * @author JSON.org
- * @version 2
- */
-public class JSONStringer extends JSONWriter {
-    /**
-     * Make a fresh JSONStringer. It can be used to build one JSON text.
-     */
-    public JSONStringer() {
-        super(new StringWriter());
-    }
-
-    /**
-     * Return the JSON text. This method is used to obtain the product of the
-     * JSONStringer instance. It will return <code>null</code> if there was a
-     * problem in the construction of the JSON text (such as the calls to
-     * <code>array</code> were not properly balanced with calls to
-     * <code>endArray</code>).
-     * @return The JSON text.
-     */
-    public String toString() {
-        return this.mode == 'd' ? this.writer.toString() : null;
-    }
-}
diff --git a/common/src/main/java/json/org/json/JSONTokener.java b/common/src/main/java/json/org/json/JSONTokener.java
deleted file mode 100644
index 23070a0c2..000000000
--- a/common/src/main/java/json/org/json/JSONTokener.java
+++ /dev/null
@@ -1,460 +0,0 @@
-package json.org.json;
-
-/*
-Copyright (c) 2002 JSON.org
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-The Software shall be used for Good, not Evil.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-*/
-
-/**
- * A JSONTokener takes a source string and extracts characters and tokens from
- * it. It is used by the JSONObject and JSONArray constructors to parse
- * JSON source strings.
- * @author JSON.org
- * @version 2
- */
-public class JSONTokener {
-
-    /**
-     * The index of the next character.
-     */
-    private int myIndex;
-
-
-    /**
-     * The source string being tokenized.
-     */
-    private String mySource;
-
-
-    /**
-     * Construct a JSONTokener from a string.
-     *
-     * @param s     A source string.
-     */
-    public JSONTokener(String s) {
-        this.myIndex = 0;
-        this.mySource = s;
-    }
-
-
-    /**
-     * Back up one character. This provides a sort of lookahead capability,
-     * so that you can test for a digit or letter before attempting to parse
-     * the next number or identifier.
-     */
-    public void back() {
-        if (this.myIndex > 0) {
-            this.myIndex -= 1;
-        }
-    }
-
-
-
-    /**
-     * Get the hex value of a character (base16).
-     * @param c A character between '0' and '9' or between 'A' and 'F' or
-     * between 'a' and 'f'.
-     * @return  An int between 0 and 15, or -1 if c was not a hex digit.
-     */
-    public static int dehexchar(char c) {
-        if (c >= '0' && c <= '9') {
-            return c - '0';
-        }
-        if (c >= 'A' && c <= 'F') {
-            return c - ('A' - 10);
-        }
-        if (c >= 'a' && c <= 'f') {
-            return c - ('a' - 10);
-        }
-        return -1;
-    }
-
-
-    /**
-     * Determine if the source string still contains characters that next()
-     * can consume.
-     * @return true if not yet at the end of the source.
-     */
-    public boolean more() {
-        return this.myIndex < this.mySource.length();
-    }
-
-
-    /**
-     * Get the next character in the source string.
-     *
-     * @return The next character, or 0 if past the end of the source string.
-     */
-    public char next() {
-        if (more()) {
-            char c = this.mySource.charAt(this.myIndex);
-            this.myIndex += 1;
-            return c;
-        }
-        return 0;
-    }
-
-
-    /**
-     * Consume the next character, and check that it matches a specified
-     * character.
-     * @param c The character to match.
-     * @return The character.
-     * @throws JSONException if the character does not match.
-     */
-    public char next(char c) throws JSONException {
-        char n = next();
-        if (n != c) {
-            throw syntaxError("Expected '" + c + "' and instead saw '" +
-                    n + "'.");
-        }
-        return n;
-    }
-
-
-    /**
-     * Get the next n characters.
-     *
-     * @param n     The number of characters to take.
-     * @return      A string of n characters.
-     * @throws JSONException
-     *   Substring bounds error if there are not
-     *   n characters remaining in the source string.
-     */
-     public String next(int n) throws JSONException {
-         int i = this.myIndex;
-         int j = i + n;
-         if (j >= this.mySource.length()) {
-            throw syntaxError("Substring bounds error");
-         }
-         this.myIndex += n;
-         return this.mySource.substring(i, j);
-     }
-
-
-    /**
-     * Get the next char in the string, skipping whitespace
-     * and comments (slashslash, slashstar, and hash).
-     * @throws JSONException
-     * @return  A character, or 0 if there are no more characters.
-     */
-    public char nextClean() throws JSONException {
-        for (;;) {
-            char c = next();
-            if (c == '/') {
-                switch (next()) {
-                case '/':
-                    do {
-                        c = next();
-                    } while (c != '\n' && c != '\r' && c != 0);
-                    break;
-                case '*':
-                    for (;;) {
-                        c = next();
-                        if (c == 0) {
-                            throw syntaxError("Unclosed comment.");
-                        }
-                        if (c == '*') {
-                            if (next() == '/') {
-                                break;
-                            }
-                            back();
-                        }
-                    }
-                    break;
-                default:
-                    back();
-                    return '/';
-                }
-            } else if (c == '#') {
-                do {
-                    c = next();
-                } while (c != '\n' && c != '\r' && c != 0);
-            } else if (c == 0 || c > ' ') {
-                return c;
-            }
-        }
-    }
-
-
-    /**
-     * Return the characters up to the next close quote character.
-     * Backslash processing is done. The formal JSON format does not
-     * allow strings in single quotes, but an implementation is allowed to
-     * accept them.
-     * @param quote The quoting character, either
-     *      <code>"</code>&nbsp;<small>(double quote)</small> or
-     *      <code>'</code>&nbsp;<small>(single quote)</small>.
-     * @return      A String.
-     * @throws JSONException Unterminated string.
-     */
-    public String nextString(char quote) throws JSONException {
-        char c;
-		StringBuilder sb = new StringBuilder();
-        for (;;) {
-            c = next();
-            switch (c) {
-            case 0:
-            case '\n':
-            case '\r':
-                throw syntaxError("Unterminated string");
-            case '\\':
-                c = next();
-                switch (c) {
-                case 'b':
-                    sb.append('\b');
-                    break;
-                case 't':
-                    sb.append('\t');
-                    break;
-                case 'n':
-                    sb.append('\n');
-                    break;
-                case 'f':
-                    sb.append('\f');
-                    break;
-                case 'r':
-                    sb.append('\r');
-                    break;
-                case 'u':
-                    sb.append((char)Integer.parseInt(next(4), 16));
-                    break;
-                case 'x' :
-                    sb.append((char) Integer.parseInt(next(2), 16));
-                    break;
-                default:
-                    sb.append(c);
-                }
-                break;
-            default:
-                if (c == quote) {
-                    return sb.toString();
-                }
-                sb.append(c);
-            }
-        }
-    }
-
-
-    /**
-     * Get the text up but not including the specified character or the
-     * end of line, whichever comes first.
-     * @param  d A delimiter character.
-     * @return   A string.
-     */
-    public String nextTo(char d) {
-        StringBuffer sb = new StringBuffer();
-        for (;;) {
-            char c = next();
-            if (c == d || c == 0 || c == '\n' || c == '\r') {
-                if (c != 0) {
-                    back();
-                }
-                return sb.toString().trim();
-            }
-            sb.append(c);
-        }
-    }
-
-
-    /**
-     * Get the text up but not including one of the specified delimeter
-     * characters or the end of line, whichever comes first.
-     * @param delimiters A set of delimiter characters.
-     * @return A string, trimmed.
-     */
-    public String nextTo(String delimiters) {
-        char c;
-		StringBuilder sb = new StringBuilder();
-        for (;;) {
-            c = next();
-            if (delimiters.indexOf(c) >= 0 || c == 0 ||
-                    c == '\n' || c == '\r') {
-                if (c != 0) {
-                    back();
-                }
-                return sb.toString().trim();
-            }
-            sb.append(c);
-        }
-    }
-
-
-    /**
-     * Get the next value. The value can be a Boolean, Double, Integer,
-     * JSONArray, JSONObject, Long, or String, or the JSONObject.NULL object.
-     * @throws JSONException If syntax error.
-     *
-     * @return An object.
-     */
-    public Object nextValue() throws JSONException {
-        char c = nextClean();
-        String s;
-
-        switch (c) {
-            case '"':
-            case '\'':
-                return nextString(c);
-            case '{':
-                back();
-                return new JSONObject(this);
-            case '[':
-                back();
-                return new JSONArray(this);
-        }
-
-        /*
-         * Handle unquoted text. This could be the values true, false, or
-         * null, or it can be a number. An implementation (such as this one)
-         * is allowed to also accept non-standard forms.
-         *
-         * Accumulate characters until we reach the end of the text or a
-         * formatting character.
-         */
-
-		StringBuilder sb = new StringBuilder();
-        char b = c;
-        while (c >= ' ' && ",:]}/\\\"[{;=#".indexOf(c) < 0) {
-            sb.append(c);
-            c = next();
-        }
-        back();
-
-        /*
-         * If it is true, false, or null, return the proper value.
-         */
-
-        s = sb.toString().trim();
-        if (s.equals("")) {
-            throw syntaxError("Missing value.");
-        }
-        if (s.equalsIgnoreCase("true")) {
-            return Boolean.TRUE;
-        }
-        if (s.equalsIgnoreCase("false")) {
-            return Boolean.FALSE;
-        }
-        if (s.equalsIgnoreCase("null")) {
-            return JSONObject.NULL;
-        }
-
-        /*
-         * If it might be a number, try converting it. We support the 0- and 0x-
-         * conventions. If a number cannot be produced, then the value will just
-         * be a string. Note that the 0-, 0x-, plus, and implied string
-         * conventions are non-standard. A JSON parser is free to accept
-         * non-JSON forms as long as it accepts all correct JSON forms.
-         */
-
-        if ((b >= '0' && b <= '9') || b == '.' || b == '-' || b == '+') {
-            if (b == '0') {
-                if (s.length() > 2 &&
-                        (s.charAt(1) == 'x' || s.charAt(1) == 'X')) {
-                    try {
-                        return new Integer(Integer.parseInt(s.substring(2),
-                                16));
-                    } catch (Exception e) {
-                        /* Ignore the error */
-                    }
-                } else {
-                    try {
-                        return new Integer(Integer.parseInt(s, 8));
-                    } catch (Exception e) {
-                        /* Ignore the error */
-                    }
-                }
-            }
-            try {
-                return new Integer(s);
-            } catch (Exception e) {
-                try {
-                    return new Long(s);
-                } catch (Exception f) {
-                    try {
-                        return new Double(s);
-                    }  catch (Exception g) {
-                        return s;
-                    }
-                }
-            }
-        }
-        return s;
-    }
-
-
-    /**
-     * Skip characters until the next character is the requested character.
-     * If the requested character is not found, no characters are skipped.
-     * @param to A character to skip to.
-     * @return The requested character, or zero if the requested character
-     * is not found.
-     */
-    public char skipTo(char to) {
-        char c;
-        int index = this.myIndex;
-        do {
-            c = next();
-            if (c == 0) {
-                this.myIndex = index;
-                return c;
-            }
-        } while (c != to);
-        back();
-        return c;
-    }
-
-
-    /**
-     * Skip characters until past the requested string.
-     * If it is not found, we are left at the end of the source.
-     * @param to A string to skip past.
-     */
-    public void skipPast(String to) {
-        this.myIndex = this.mySource.indexOf(to, this.myIndex);
-        if (this.myIndex < 0) {
-            this.myIndex = this.mySource.length();
-        } else {
-            this.myIndex += to.length();
-        }
-    }
-
-
-    /**
-     * Make a JSONException to signal a syntax error.
-     *
-     * @param message The error message.
-     * @return  A JSONException object, suitable for throwing
-     */
-    public JSONException syntaxError(String message) {
-        return new JSONException(message + toString());
-    }
-
-
-    /**
-     * Make a printable string of this JSONTokener.
-     *
-     * @return " at character [this.myIndex] of [this.mySource]"
-     */
-    public String toString() {
-        return " at character " + this.myIndex + " of " + this.mySource;
-    }
-}
diff --git a/common/src/main/java/json/org/json/JSONWriter.java b/common/src/main/java/json/org/json/JSONWriter.java
deleted file mode 100644
index 6d5989175..000000000
--- a/common/src/main/java/json/org/json/JSONWriter.java
+++ /dev/null
@@ -1,318 +0,0 @@
-package json.org.json;
-
-import java.io.IOException;
-import java.io.Writer;
-
-/*
-Copyright (c) 2006 JSON.org
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-The Software shall be used for Good, not Evil.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-*/
-
-/**
- * JSONWriter provides a quick and convenient way of producing JSON text.
- * The texts produced strictly conform to JSON syntax rules. No whitespace is
- * added, so the results are ready for transmission or storage. Each instance of
- * JSONWriter can produce one JSON text.
- * <p>
- * A JSONWriter instance provides a <code>value</code> method for appending
- * values to the
- * text, and a <code>key</code>
- * method for adding keys before values in objects. There are <code>array</code>
- * and <code>endArray</code> methods that make and bound array values, and
- * <code>object</code> and <code>endObject</code> methods which make and bound
- * object values. All of these methods return the JSONWriter instance,
- * permitting a cascade style. For example, <pre>
- * new JSONWriter(myWriter)
- *     .object()
- *         .key("JSON")
- *         .value("Hello, World!")
- *     .endObject();</pre> which writes <pre>
- * {"JSON":"Hello, World!"}</pre>
- * <p>
- * The first method called must be <code>array</code> or <code>object</code>.
- * There are no methods for adding commas or colons. JSONWriter adds them for
- * you. Objects and arrays can be nested up to 20 levels deep.
- * <p>
- * This can sometimes be easier than using a JSONObject to build a string.
- * @author JSON.org
- * @version 2
- */
-public class JSONWriter {
-    private static final int maxdepth = 20;
-
-    /**
-     * The comma flag determines if a comma should be output before the next
-     * value.
-     */
-    private boolean comma;
-
-    /**
-     * The current mode. Values:
-     * 'a' (array),
-     * 'd' (done),
-     * 'i' (initial),
-     * 'k' (key),
-     * 'o' (object).
-     */
-    protected char mode;
-
-    /**
-     * The object/array stack.
-     */
-    private char stack[];
-
-    /**
-     * The stack top index. A value of 0 indicates that the stack is empty.
-     */
-    private int top;
-
-    /**
-     * The writer that will receive the output.
-     */
-    protected Writer writer;
-
-    /**
-     * Make a fresh JSONWriter. It can be used to build one JSON text.
-     */
-    public JSONWriter(Writer w) {
-        this.comma = false;
-        this.mode = 'i';
-        this.stack = new char[maxdepth];
-        this.top = 0;
-        this.writer = w;
-    }
-
-    /**
-     * Append a value.
-     * @param s A string value.
-     * @return this
-     * @throws JSONException If the value is out of sequence.
-     */
-    private JSONWriter append(String s) throws JSONException {
-        if (s == null) {
-            throw new JSONException("Null pointer");
-        }
-        if (this.mode == 'o' || this.mode == 'a') {
-            try {
-                if (this.comma && this.mode == 'a') {
-                    this.writer.write(',');
-                }
-                this.writer.write(s);
-            } catch (IOException e) {
-                throw new JSONException(e);
-            }
-            if (this.mode == 'o') {
-                this.mode = 'k';
-            }
-            this.comma = true;
-            return this;
-        }
-        throw new JSONException("Value out of sequence.");
-    }
-
-    /**
-     * Begin appending a new array. All values until the balancing
-     * <code>endArray</code> will be appended to this array. The
-     * <code>endArray</code> method must be called to mark the array's end.
-     * @return this
-     * @throws JSONException If the nesting is too deep, or if the object is
-     * started in the wrong place (for example as a key or after the end of the
-     * outermost array or object).
-     */
-    public JSONWriter array() throws JSONException {
-        if (this.mode == 'i' || this.mode == 'o' || this.mode == 'a') {
-            this.push('a');
-            this.append("[");
-            this.comma = false;
-            return this;
-        }
-        throw new JSONException("Misplaced array.");
-    }
-
-    /**
-     * End something.
-     * @param m Mode
-     * @param c Closing character
-     * @return this
-     * @throws JSONException If unbalanced.
-     */
-    private JSONWriter end(char m, char c) throws JSONException {
-        if (this.mode != m) {
-            throw new JSONException(m == 'o' ? "Misplaced endObject." :
-                "Misplaced endArray.");
-        }
-        this.pop(m);
-        try {
-            this.writer.write(c);
-        } catch (IOException e) {
-            throw new JSONException(e);
-        }
-        this.comma = true;
-        return this;
-    }
-
-    /**
-     * End an array. This method most be called to balance calls to
-     * <code>array</code>.
-     * @return this
-     * @throws JSONException If incorrectly nested.
-     */
-    public JSONWriter endArray() throws JSONException {
-        return this.end('a', ']');
-    }
-
-    /**
-     * End an object. This method most be called to balance calls to
-     * <code>object</code>.
-     * @return this
-     * @throws JSONException If incorrectly nested.
-     */
-    public JSONWriter endObject() throws JSONException {
-        return this.end('k', '}');
-    }
-
-    /**
-     * Append a key. The key will be associated with the next value. In an
-     * object, every value must be preceded by a key.
-     * @param s A key string.
-     * @return this
-     * @throws JSONException If the key is out of place. For example, keys
-     *  do not belong in arrays or if the key is null.
-     */
-    public JSONWriter key(String s) throws JSONException {
-        if (s == null) {
-            throw new JSONException("Null key.");
-        }
-        if (this.mode == 'k') {
-            try {
-                if (this.comma) {
-                    this.writer.write(',');
-                }
-                this.writer.write(JSONObject.quote(s));
-                this.writer.write(':');
-                this.comma = false;
-                this.mode = 'o';
-                return this;
-            } catch (IOException e) {
-                throw new JSONException(e);
-            }
-        }
-        throw new JSONException("Misplaced key.");
-    }
-
-
-    /**
-     * Begin appending a new object. All keys and values until the balancing
-     * <code>endObject</code> will be appended to this object. The
-     * <code>endObject</code> method must be called to mark the object's end.
-     * @return this
-     * @throws JSONException If the nesting is too deep, or if the object is
-     * started in the wrong place (for example as a key or after the end of the
-     * outermost array or object).
-     */
-    public JSONWriter object() throws JSONException {
-        if (this.mode == 'i') {
-            this.mode = 'o';
-        }
-        if (this.mode == 'o' || this.mode == 'a') {
-            this.append("{");
-            this.push('k');
-            this.comma = false;
-            return this;
-        }
-        throw new JSONException("Misplaced object.");
-
-    }
-
-
-    /**
-     * Pop an array or object scope.
-     * @param c The scope to close.
-     * @throws JSONException If nesting is wrong.
-     */
-    private void pop(char c) throws JSONException {
-        if (this.top <= 0 || this.stack[this.top - 1] != c) {
-            throw new JSONException("Nesting error.");
-        }
-        this.top -= 1;
-        this.mode = this.top == 0 ? 'd' : this.stack[this.top - 1];
-    }
-
-    /**
-     * Push an array or object scope.
-     * @param c The scope to open.
-     * @throws JSONException If nesting is too deep.
-     */
-    private void push(char c) throws JSONException {
-        if (this.top >= maxdepth) {
-            throw new JSONException("Nesting too deep.");
-        }
-        this.stack[this.top] = c;
-        this.mode = c;
-        this.top += 1;
-    }
-
-
-    /**
-     * Append either the value <code>true</code> or the value
-     * <code>false</code>.
-     * @param b A boolean.
-     * @return this
-     * @throws JSONException
-     */
-    public JSONWriter value(boolean b) throws JSONException {
-        return this.append(b ? "true" : "false");
-    }
-
-    /**
-     * Append a double value.
-     * @param d A double.
-     * @return this
-     * @throws JSONException If the number is not finite.
-     */
-    public JSONWriter value(double d) throws JSONException {
-        return this.value(new Double(d));
-    }
-
-    /**
-     * Append a long value.
-     * @param l A long.
-     * @return this
-     * @throws JSONException
-     */
-    public JSONWriter value(long l) throws JSONException {
-        return this.append(Long.toString(l));
-    }
-
-
-    /**
-     * Append an object value.
-     * @param o The object to append. It can be null, or a Boolean, Number,
-     *   String, JSONObject, or JSONArray, or an object with a toJSONString()
-     *   method.
-     * @return this
-     * @throws JSONException If the value is out of sequence.
-     */
-    public JSONWriter value(Object o) throws JSONException {
-        return this.append(JSONObject.valueToString(o));
-    }
-}
diff --git a/common/src/main/java/json/org/json/Test.java b/common/src/main/java/json/org/json/Test.java
deleted file mode 100644
index 0ec4750a9..000000000
--- a/common/src/main/java/json/org/json/Test.java
+++ /dev/null
@@ -1,413 +0,0 @@
-package json.org.json;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Map;
-import java.io.StringWriter;
-
-/**
- * Test class. This file is not formally a member of the org.json library.
- * It is just a casual test tool.
- */
-public class Test {
-
-    /**
-     * Entry point.
-     * @param args
-     */
-    public static void main(String args[]) {
-        Iterator it;
-        JSONArray a;
-        JSONObject j;
-        JSONStringer jj;
-        String s;
-
-// Obj is a typical class that implements JSONString.
-
-        class Obj implements JSONString {
-        	public String aString;
-        	public double aNumber;
-        	public boolean aBoolean;
-
-            public Obj(String string, double n, boolean b) {
-                this.aString = string;
-                this.aNumber = n;
-                this.aBoolean = b;
-            }
-
-            public String toJSONString() {
-            	return "{" + JSONObject.quote(this.aString) + ":" +
-            	JSONObject.doubleToString(this.aNumber) + "}";
-            }
-            public String toString() {
-            	return this.aString + " " + this.aNumber + " " + this.aBoolean;
-            }
-        }
-
-
-        try {
-        	String sa[] = {"aString", "aNumber", "aBoolean"};
-        	Obj obj = new Obj("A string, a number, and a boolean", 42, true);
-
-            j = XML.toJSONObject("<![CDATA[This is a collection of test patterns and examples for org.json.]]>");
-            System.out.println(j.toString());
-
-            jj = new JSONStringer();
-            s = jj.object()
-                .key("foo")
-                .value("bar")
-                .key("baz")
-                .array()
-                    .object()
-                        .key("quux")
-                        .value("Thanks, Josh!")
-                    .endObject()
-                .endArray()
-                .endObject()
-                .toString();
-            System.out.println(s);
-
-            System.out.println(new JSONStringer()
-                .object()
-                .key("a")
-                .array()
-                .array()
-                .array()
-                .value("b")
-                .endArray()
-                .endArray()
-                .endArray()
-                .endObject()
-                .toString());
-
-            jj = new JSONStringer();
-            jj.array();
-            jj.value(1);
-            jj.array();
-            jj.value(null);
-            jj.array();
-            jj.object();
-            jj.key("empty-array").array().endArray();
-            jj.key("answer").value(42);
-            jj.key("null").value(null);
-            jj.key("false").value(false);
-            jj.key("true").value(true);
-            jj.key("big").value(123456789e+88);
-            jj.key("small").value(123456789e-88);
-            jj.key("empty-object").object().endObject();
-            jj.key("long");
-            jj.value(9223372036854775807L);
-            jj.endObject();
-            jj.value("two");
-            jj.endArray();
-            jj.value(true);
-            jj.endArray();
-            jj.value(98.6);
-            jj.value(-100.0);
-            jj.object();
-            jj.endObject();
-            jj.object();
-            jj.key("one");
-            jj.value(1.00);
-            jj.endObject();
-            jj.value(obj);
-            jj.endArray();
-            System.out.println(jj.toString());
-
-            System.out.println(new JSONArray(jj.toString()).toString(4));
-
-            j = new JSONObject(obj, sa);
-            j.put("test", obj);
-            j.put("comment", "This object contains a test object that implements JSONString");
-            System.out.println(j.toString(4));
-
-            j = new JSONObject("{slashes: '///', closetag: '</script>', backslash:'\\\\', ei: {quotes: '\"\\''},eo: {a: '\"quoted\"', b:\"don't\"}, quotes: [\"'\", '\"']}");
-            System.out.println(j.toString(2));
-            System.out.println(XML.toString(j));
-            System.out.println("");
-
-            j = new JSONObject(
-                "/*comment*/{foo: [true, false,9876543210,    0.0, 1.00000001,  1.000000000001, 1.00000000000000001," +
-                " .00000000000000001, 2.00, 0.1, 2e100, -32,[],{}, \"string\"], " +
-                "  to   : null, op : 'Good'," +
-                "ten:10} postfix comment");
-            j.put("String", "98.6");
-            j.put("JSONObject", new JSONObject());
-            j.put("JSONArray", new JSONArray());
-            j.put("int", 57);
-            j.put("double", 123456789012345678901234567890.);
-            j.put("true", true);
-            j.put("false", false);
-            j.put("null", JSONObject.NULL);
-            j.put("bool", "true");
-            j.put("zero", -0.0);
-            a = j.getJSONArray("foo");
-            a.put(666);
-            a.put(2001.99);
-            a.put("so \"fine\".");
-            a.put("so <fine>.");
-            a.put(true);
-            a.put(false);
-            a.put(new JSONArray());
-            a.put(new JSONObject());
-            System.out.println(j.toString(4));
-            System.out.println(XML.toString(j));
-
-            System.out.println("String: " + j.getDouble("String"));
-            System.out.println("  bool: " + j.getBoolean("bool"));
-            System.out.println("    to: " + j.getString("to"));
-            System.out.println("  true: " + j.getString("true"));
-            System.out.println("   foo: " + j.getJSONArray("foo"));
-            System.out.println("    op: " + j.getString("op"));
-            System.out.println("   ten: " + j.getInt("ten"));
-            System.out.println("  oops: " + j.optBoolean("oops"));
-
-            j = XML.toJSONObject("<xml one = 1 two=' \"2\" '><five></five>First \u0009&lt;content&gt;<five></five> This is \"content\". <three>  3  </three>JSON does not preserve the sequencing of elements and contents.<three>  III  </three>  <three>  T H R E E</three><four/>Content text is an implied structure in XML. <six content=\"6\"/>JSON does not have implied structure:<seven>7</seven>everything is explicit.<![CDATA[CDATA blocks<are><supported>!]]></xml>");
-            System.out.println(j.toString(2));
-            System.out.println(XML.toString(j));
-            System.out.println("");
-
-            j = XML.toJSONObject("<mapping><empty/>   <class name = \"Customer\">      <field name = \"ID\" type = \"string\">         <bind-xml name=\"ID\" node=\"attribute\"/>      </field>      <field name = \"FirstName\" type = \"FirstName\"/>      <field name = \"MI\" type = \"MI\"/>      <field name = \"LastName\" type = \"LastName\"/>   </class>   <class name = \"FirstName\">      <field name = \"text\">         <bind-xml name = \"text\" node = \"text\"/>      </field>   </class>   <class name = \"MI\">      <field name = \"text\">         <bind-xml name = \"text\" node = \"text\"/>      </field>   </class>   <class name = \"LastName\">      <field name = \"text\">         <bind-xml name = \"text\" node = \"text\"/>      </field>   </class></mapping>");
-
-            System.out.println(j.toString(2));
-            System.out.println(XML.toString(j));
-            System.out.println("");
-
-            j = XML.toJSONObject("<?xml version=\"1.0\" ?><Book Author=\"Anonymous\"><Title>Sample Book</Title><Chapter id=\"1\">This is chapter 1. It is not very long or interesting.</Chapter><Chapter id=\"2\">This is chapter 2. Although it is longer than chapter 1, it is not any more interesting.</Chapter></Book>");
-            System.out.println(j.toString(2));
-            System.out.println(XML.toString(j));
-            System.out.println("");
-
-            j = XML.toJSONObject("<!DOCTYPE bCard 'http://www.cs.caltech.edu/~adam/schemas/bCard'><bCard><?xml default bCard        firstname = ''        lastname  = '' company   = '' email = '' homepage  = ''?><bCard        firstname = 'Rohit'        lastname  = 'Khare'        company   = 'MCI'        email     = 'khare@mci.net'        homepage  = 'http://pest.w3.org/'/><bCard        firstname = 'Adam'        lastname  = 'Rifkin'        company   = 'Caltech Infospheres Project'        email     = 'adam@cs.caltech.edu'        homepage  = 'http://www.cs.caltech.edu/~adam/'/></bCard>");
-            System.out.println(j.toString(2));
-            System.out.println(XML.toString(j));
-            System.out.println("");
-
-            j = XML.toJSONObject("<?xml version=\"1.0\"?><customer>    <firstName>        <text>Fred</text>    </firstName>    <ID>fbs0001</ID>    <lastName> <text>Scerbo</text>    </lastName>    <MI>        <text>B</text>    </MI></customer>");
-            System.out.println(j.toString(2));
-            System.out.println(XML.toString(j));
-            System.out.println("");
-
-            j = XML.toJSONObject("<!ENTITY tp-address PUBLIC '-//ABC University::Special Collections Library//TEXT (titlepage: name and address)//EN' 'tpspcoll.sgm'><list type='simple'><head>Repository Address </head><item>Special Collections Library</item><item>ABC University</item><item>Main Library, 40 Circle Drive</item><item>Ourtown, Pennsylvania</item><item>17654 USA</item></list>");
-            System.out.println(j.toString());
-            System.out.println(XML.toString(j));
-            System.out.println("");
-
-            j = XML.toJSONObject("<test intertag status=ok><empty/>deluxe<blip sweet=true>&amp;&quot;toot&quot;&toot;&#x41;</blip><x>eks</x><w>bonus</w><w>bonus2</w></test>");
-            System.out.println(j.toString(2));
-            System.out.println(XML.toString(j));
-            System.out.println("");
-
-            j = HTTP.toJSONObject("GET / HTTP/1.0\nAccept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, */*\nAccept-Language: en-us\nUser-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows 98; Win 9x 4.90; T312461; Q312461)\nHost: www.nokko.com\nConnection: keep-alive\nAccept-encoding: gzip, deflate\n");
-            System.out.println(j.toString(2));
-            System.out.println(HTTP.toString(j));
-            System.out.println("");
-
-            j = HTTP.toJSONObject("HTTP/1.1 200 Oki Doki\nDate: Sun, 26 May 2002 17:38:52 GMT\nServer: Apache/1.3.23 (Unix) mod_perl/1.26\nKeep-Alive: timeout=15, max=100\nConnection: Keep-Alive\nTransfer-Encoding: chunked\nContent-Type: text/html\n");
-            System.out.println(j.toString(2));
-            System.out.println(HTTP.toString(j));
-            System.out.println("");
-
-            j = new JSONObject("{nix: null, nux: false, null: 'null', 'Request-URI': '/', Method: 'GET', 'HTTP-Version': 'HTTP/1.0'}");
-            System.out.println(j.toString(2));
-            System.out.println("isNull: " + j.isNull("nix"));
-            System.out.println("   has: " + j.has("nix"));
-            System.out.println(XML.toString(j));
-            System.out.println(HTTP.toString(j));
-            System.out.println("");
-
-            j = XML.toJSONObject("<?xml version='1.0' encoding='UTF-8'?>"+"\n\n"+"<SOAP-ENV:Envelope"+
-              " xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\""+
-              " xmlns:xsi=\"http://www.w3.org/1999/XMLSchema-instance\""+
-              " xmlns:xsd=\"http://www.w3.org/1999/XMLSchema\">"+
-              "<SOAP-ENV:Body><ns1:doGoogleSearch"+
-              " xmlns:ns1=\"urn:GoogleSearch\""+
-              " SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">"+
-              "<key xsi:type=\"xsd:string\">GOOGLEKEY</key> <q"+
-              " xsi:type=\"xsd:string\">'+search+'</q> <start"+
-              " xsi:type=\"xsd:int\">0</start> <maxResults"+
-              " xsi:type=\"xsd:int\">10</maxResults> <filter"+
-              " xsi:type=\"xsd:boolean\">true</filter> <restrict"+
-              " xsi:type=\"xsd:string\"></restrict> <safeSearch"+
-              " xsi:type=\"xsd:boolean\">false</safeSearch> <lr"+
-              " xsi:type=\"xsd:string\"></lr> <ie"+
-              " xsi:type=\"xsd:string\">latin1</ie> <oe"+
-              " xsi:type=\"xsd:string\">latin1</oe>"+
-              "</ns1:doGoogleSearch>"+
-              "</SOAP-ENV:Body></SOAP-ENV:Envelope>");
-            System.out.println(j.toString(2));
-            System.out.println(XML.toString(j));
-            System.out.println("");
-
-            j = new JSONObject("{Envelope: {Body: {\"ns1:doGoogleSearch\": {oe: \"latin1\", filter: true, q: \"'+search+'\", key: \"GOOGLEKEY\", maxResults: 10, \"SOAP-ENV:encodingStyle\": \"http://schemas.xmlsoap.org/soap/encoding/\", start: 0, ie: \"latin1\", safeSearch:false, \"xmlns:ns1\": \"urn:GoogleSearch\"}}}}");
-            System.out.println(j.toString(2));
-            System.out.println(XML.toString(j));
-            System.out.println("");
-
-            j = CookieList.toJSONObject("  f%oo = b+l=ah  ; o;n%40e = t.wo ");
-            System.out.println(j.toString(2));
-            System.out.println(CookieList.toString(j));
-            System.out.println("");
-
-            j = Cookie.toJSONObject("f%oo=blah; secure ;expires = April 24, 2002");
-            System.out.println(j.toString(2));
-            System.out.println(Cookie.toString(j));
-            System.out.println("");
-
-            j = new JSONObject("{script: 'It is not allowed in HTML to send a close script tag in a string<script>because it confuses browsers</script>so we insert a backslash before the /'}");
-            System.out.println(j.toString());
-            System.out.println("");
-
-            JSONTokener jt = new JSONTokener("{op:'test', to:'session', pre:1}{op:'test', to:'session', pre:2}");
-            j = new JSONObject(jt);
-            System.out.println(j.toString());
-            System.out.println("pre: " + j.optInt("pre"));
-            int i = jt.skipTo('{');
-            System.out.println(i);
-            j = new JSONObject(jt);
-            System.out.println(j.toString());
-            System.out.println("");
-
-            a = CDL.toJSONArray("No quotes, 'Single Quotes', \"Double Quotes\"\n1,'2',\"3\"\n,'It is \"good,\"', \"It works.\"\n\n");
-
-            System.out.println(CDL.toString(a));
-            System.out.println("");
-            System.out.println(a.toString(4));
-            System.out.println("");
-
-            a = new JSONArray(" [\"<escape>\", next is an implied null , , ok,] ");
-            System.out.println(a.toString());
-            System.out.println("");
-            System.out.println(XML.toString(a));
-            System.out.println("");
-
-            j = new JSONObject("{ fun => with non-standard forms ; forgiving => This package can be used to parse formats that are similar to but not stricting conforming to JSON; why=To make it easier to migrate existing data to JSON,one = [[1.00]]; uno=[[{1=>1}]];'+':+6e66 ;pluses=+++;empty = '' , 'double':0.666,true: TRUE, false: FALSE, null=NULL;[true] = [[!,@;*]]; string=>  o. k. ; # comment\r oct=0666; hex=0x666; dec=666; o=0999; noh=0x0x}");
-            System.out.println(j.toString(4));
-            System.out.println("");
-            if (j.getBoolean("true") && !j.getBoolean("false")) {
-                System.out.println("It's all good");
-            }
-
-            System.out.println("");
-            j = new JSONObject(j, new String[]{"dec", "oct", "hex", "missing"});
-            System.out.println(j.toString(4));
-
-            System.out.println("");
-            System.out.println(new JSONStringer().array().value(a).value(j).endArray());
-
-            j = new JSONObject("{string: \"98.6\", long: 2147483648, int: 2147483647, longer: 9223372036854775807, double: 9223372036854775808}");
-            System.out.println(j.toString(4));
-
-            System.out.println("\ngetInt");
-            System.out.println("int    " + j.getInt("int"));
-            System.out.println("long   " + j.getInt("long"));
-            System.out.println("longer " + j.getInt("longer"));
-            System.out.println("double " + j.getInt("double"));
-            System.out.println("string " + j.getInt("string"));
-
-            System.out.println("\ngetLong");
-            System.out.println("int    " + j.getLong("int"));
-            System.out.println("long   " + j.getLong("long"));
-            System.out.println("longer " + j.getLong("longer"));
-            System.out.println("double " + j.getLong("double"));
-            System.out.println("string " + j.getLong("string"));
-
-            System.out.println("\ngetDouble");
-            System.out.println("int    " + j.getDouble("int"));
-            System.out.println("long   " + j.getDouble("long"));
-            System.out.println("longer " + j.getDouble("longer"));
-            System.out.println("double " + j.getDouble("double"));
-            System.out.println("string " + j.getDouble("string"));
-
-            j.put("good sized", 9223372036854775807L);
-            System.out.println(j.toString(4));
-
-            a = new JSONArray("[2147483647, 2147483648, 9223372036854775807, 9223372036854775808]");
-            System.out.println(a.toString(4));
-
-            System.out.println("\nKeys: ");
-            it = j.keys();
-            while (it.hasNext()) {
-                s = (String)it.next();
-                System.out.println(s + ": " + j.getString(s));
-            }
-
-
-            System.out.println("\naccumulate: ");
-            j = new JSONObject();
-            j.accumulate("stooge", "Curly");
-            j.accumulate("stooge", "Larry");
-            j.accumulate("stooge", "Moe");
-            a = j.getJSONArray("stooge");
-            a.put(5, "Shemp");
-            System.out.println(j.toString(4));
-
-            System.out.println("\nwrite:");
-            System.out.println(j.write(new StringWriter()));
-
-            s = "<xml empty><a></a><a>1</a><a>22</a><a>333</a></xml>";
-            j = XML.toJSONObject(s);
-            System.out.println(j.toString(4));
-            System.out.println(XML.toString(j));
-
-            s = "<book><chapter>Content of the first chapter</chapter><chapter>Content of the second chapter      <chapter>Content of the first subchapter</chapter>      <chapter>Content of the second subchapter</chapter></chapter><chapter>Third Chapter</chapter></book>";
-            j = XML.toJSONObject(s);
-            System.out.println(j.toString(4));
-            System.out.println(XML.toString(j));
-
-            Collection c = null;
-            Map m = null;
-
-            j = new JSONObject(m);
-            a = new JSONArray(c);
-            j.append("stooge", "Joe DeRita");
-            j.put("map", m);
-            j.put("collection", c);
-            j.put("array", a);
-            a.put(m);
-            a.put(c);
-            System.out.println(j.toString(4));
-
-            System.out.println("\nTesting Exceptions: ");
-
-            System.out.print("Exception: ");
-            try {
-                System.out.println(j.getDouble("stooge"));
-            } catch (Exception e) {
-                System.out.println(e);
-            }
-            System.out.print("Exception: ");
-            try {
-                System.out.println(j.getDouble("howard"));
-            } catch (Exception e) {
-                System.out.println(e);
-            }
-            System.out.print("Exception: ");
-            try {
-                System.out.println(j.put(null, "howard"));
-            } catch (Exception e) {
-                System.out.println(e);
-            }
-            System.out.print("Exception: ");
-            try {
-                System.out.println(a.getDouble(0));
-            } catch (Exception e) {
-                System.out.println(e);
-            }
-            System.out.print("Exception: ");
-            try {
-                System.out.println(a.get(-1));
-            } catch (Exception e) {
-                System.out.println(e);
-            }
-            System.out.print("Exception: ");
-            try {
-                System.out.println(a.put(Double.NaN));
-            } catch (Exception e) {
-                System.out.println(e);
-            }
-        } catch (Exception e) {
-            System.out.println(e.toString());
-        }
-    }
-}
diff --git a/common/src/main/java/json/org/json/XML.java b/common/src/main/java/json/org/json/XML.java
deleted file mode 100644
index 3c6861191..000000000
--- a/common/src/main/java/json/org/json/XML.java
+++ /dev/null
@@ -1,401 +0,0 @@
-package json.org.json;
-
-/*
-Copyright (c) 2002 JSON.org
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-The Software shall be used for Good, not Evil.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-*/
-
-import java.util.Iterator;
-
-
-/**
- * This provides static methods to convert an XML text into a JSONObject,
- * and to covert a JSONObject into an XML text.
- * @author JSON.org
- * @version 2
- */
-public class XML {
-
-    /** The Character '&'. */
-    public static final Character AMP   = new Character('&');
-
-    /** The Character '''. */
-    public static final Character APOS  = new Character('\'');
-
-    /** The Character '!'. */
-    public static final Character BANG  = new Character('!');
-
-    /** The Character '='. */
-    public static final Character EQ    = new Character('=');
-
-    /** The Character '>'. */
-    public static final Character GT    = new Character('>');
-
-    /** The Character '<'. */
-    public static final Character LT    = new Character('<');
-
-    /** The Character '?'. */
-    public static final Character QUEST = new Character('?');
-
-    /** The Character '"'. */
-    public static final Character QUOT  = new Character('"');
-
-    /** The Character '/'. */
-    public static final Character SLASH = new Character('/');
-
-    /**
-     * Replace special characters with XML escapes:
-     * <pre>
-     * &amp; <small>(ampersand)</small> is replaced by &amp;amp;
-     * &lt; <small>(less than)</small> is replaced by &amp;lt;
-     * &gt; <small>(greater than)</small> is replaced by &amp;gt;
-     * &quot; <small>(double quote)</small> is replaced by &amp;quot;
-     * </pre>
-     * @param string The string to be escaped.
-     * @return The escaped string.
-     */
-    public static String escape(String string) {
-        StringBuffer sb = new StringBuffer();
-        for (int i = 0, len = string.length(); i < len; i++) {
-            char c = string.charAt(i);
-            switch (c) {
-            case '&':
-                sb.append("&amp;");
-                break;
-            case '<':
-                sb.append("&lt;");
-                break;
-            case '>':
-                sb.append("&gt;");
-                break;
-            case '"':
-                sb.append("&quot;");
-                break;
-            default:
-                sb.append(c);
-            }
-        }
-        return sb.toString();
-    }
-
-    /**
-     * Scan the content following the named tag, attaching it to the context.
-     * @param x       The XMLTokener containing the source string.
-     * @param context The JSONObject that will include the new material.
-     * @param name    The tag name.
-     * @return true if the close tag is processed.
-     * @throws JSONException
-     */
-    private static boolean parse(XMLTokener x, JSONObject context,
-                                 String name) throws JSONException {
-        char       c;
-        int        i;
-        String     n;
-        JSONObject o = null;
-        String     s;
-        Object     t;
-
-// Test for and skip past these forms:
-//      <!-- ... -->
-//      <!   ...   >
-//      <![  ... ]]>
-//      <?   ...  ?>
-// Report errors for these forms:
-//      <>
-//      <=
-//      <<
-
-        t = x.nextToken();
-
-// <!
-
-        if (t == BANG) {
-            c = x.next();
-            if (c == '-') {
-                if (x.next() == '-') {
-                    x.skipPast("-->");
-                    return false;
-                }
-                x.back();
-            } else if (c == '[') {
-                t = x.nextToken();
-                if (t.equals("CDATA")) {
-                    if (x.next() == '[') {
-                        s = x.nextCDATA();
-                        if (s.length() > 0) {
-                            context.accumulate("content", s);
-                        }
-                        return false;
-                    }
-                }
-                throw x.syntaxError("Expected 'CDATA['");
-            }
-            i = 1;
-            do {
-                t = x.nextMeta();
-                if (t == null) {
-                    throw x.syntaxError("Missing '>' after '<!'.");
-                } else if (t == LT) {
-                    i += 1;
-                } else if (t == GT) {
-                    i -= 1;
-                }
-            } while (i > 0);
-            return false;
-        } else if (t == QUEST) {
-
-// <?
-
-            x.skipPast("?>");
-            return false;
-        } else if (t == SLASH) {
-
-// Close tag </
-
-            if (name == null || !x.nextToken().equals(name)) {
-                throw x.syntaxError("Mismatched close tag");
-            }
-            if (x.nextToken() != GT) {
-                throw x.syntaxError("Misshaped close tag");
-            }
-            return true;
-
-        } else if (t instanceof Character) {
-            throw x.syntaxError("Misshaped tag");
-
-// Open tag <
-
-        } else {
-            n = (String)t;
-            t = null;
-            o = new JSONObject();
-            for (;;) {
-                if (t == null) {
-                    t = x.nextToken();
-                }
-
-// attribute = value
-
-                if (t instanceof String) {
-                    s = (String)t;
-                    t = x.nextToken();
-                    if (t == EQ) {
-                        t = x.nextToken();
-                        if (!(t instanceof String)) {
-                            throw x.syntaxError("Missing value");
-                        }
-                        o.accumulate(s, t);
-                        t = null;
-                    } else {
-                        o.accumulate(s, "");
-                    }
-
-// Empty tag <.../>
-
-                } else if (t == SLASH) {
-                    if (x.nextToken() != GT) {
-                        throw x.syntaxError("Misshaped tag");
-                    }
-                    context.accumulate(n, o);
-                    return false;
-
-// Content, between <...> and </...>
-
-                } else if (t == GT) {
-                    for (;;) {
-                        t = x.nextContent();
-                        if (t == null) {
-                            if (name != null) {
-                                throw x.syntaxError("Unclosed tag " + name);
-                            }
-                            return false;
-                        } else if (t instanceof String) {
-                            s = (String)t;
-                            if (s.length() > 0) {
-                                o.accumulate("content", s);
-                            }
-
-// Nested element
-
-                        } else if (t == LT) {
-                            if (parse(x, o, n)) {
-                                if (o.length() == 0) {
-                                    context.accumulate(n, "");
-                                } else if (o.length() == 1 &&
-                                       o.opt("content") != null) {
-                                    context.accumulate(n, o.opt("content"));
-                                } else {
-                                    context.accumulate(n, o);
-                                }
-                                return false;
-                            }
-                        }
-                    }
-                } else {
-                    throw x.syntaxError("Misshaped tag");
-                }
-            }
-        }
-    }
-
-
-    /**
-     * Convert a well-formed (but not necessarily valid) XML string into a
-     * JSONObject. Some information may be lost in this transformation
-     * because JSON is a data format and XML is a document format. XML uses
-     * elements, attributes, and content text, while JSON uses unordered
-     * collections of name/value pairs and arrays of values. JSON does not
-     * does not like to distinguish between elements and attributes.
-     * Sequences of similar elements are represented as JSONArrays. Content
-     * text may be placed in a "content" member. Comments, prologs, DTDs, and
-     * <code>&lt;[ [ ]]></code> are ignored.
-     * @param string The source string.
-     * @return A JSONObject containing the structured data from the XML string.
-     * @throws JSONException
-     */
-    public static JSONObject toJSONObject(String string) throws JSONException {
-        JSONObject o = new JSONObject();
-        XMLTokener x = new XMLTokener(string);
-        while (x.more()) {
-            x.skipPast("<");
-            parse(x, o, null);
-        }
-        return o;
-    }
-
-
-    /**
-     * Convert a JSONObject into a well-formed, element-normal XML string.
-     * @param o A JSONObject.
-     * @return  A string.
-     * @throws  JSONException
-     */
-    public static String toString(Object o) throws JSONException {
-        return toString(o, null);
-    }
-
-
-    /**
-     * Convert a JSONObject into a well-formed, element-normal XML string.
-     * @param o A JSONObject.
-     * @param tagName The optional name of the enclosing tag.
-     * @return A string.
-     * @throws JSONException
-     */
-    public static String toString(Object o, String tagName)
-            throws JSONException {
-        StringBuffer b = new StringBuffer();
-        int          i;
-        JSONArray    ja;
-        JSONObject   jo;
-        String       k;
-        Iterator     keys;
-        int          len;
-        String       s;
-        Object       v;
-        if (o instanceof JSONObject) {
-
-// Emit <tagName>
-
-            if (tagName != null) {
-                b.append('<');
-                b.append(tagName);
-                b.append('>');
-            }
-
-// Loop thru the keys.
-
-            jo = (JSONObject)o;
-            keys = jo.keys();
-            while (keys.hasNext()) {
-                k = keys.next().toString();
-                v = jo.get(k);
-                if (v instanceof String) {
-                    s = (String)v;
-                } else {
-                    s = null;
-                }
-
-// Emit content in body
-
-                if (k.equals("content")) {
-                    if (v instanceof JSONArray) {
-                        ja = (JSONArray)v;
-                        len = ja.length();
-                        for (i = 0; i < len; i += 1) {
-                            if (i > 0) {
-                                b.append('\n');
-                            }
-                            b.append(escape(ja.get(i).toString()));
-                        }
-                    } else {
-                        b.append(escape(v.toString()));
-                    }
-
-// Emit an array of similar keys
-
-                } else if (v instanceof JSONArray) {
-                    ja = (JSONArray)v;
-                    len = ja.length();
-                    for (i = 0; i < len; i += 1) {
-                        b.append(toString(ja.get(i), k));
-                    }
-                } else if (v.equals("")) {
-                    b.append('<');
-                    b.append(k);
-                    b.append("/>");
-
-// Emit a new tag <k>
-
-                } else {
-                    b.append(toString(v, k));
-                }
-            }
-            if (tagName != null) {
-
-// Emit the </tagname> close tag
-
-                b.append("</");
-                b.append(tagName);
-                b.append('>');
-            }
-            return b.toString();
-
-// XML does not have good support for arrays. If an array appears in a place
-// where XML is lacking, synthesize an <array> element.
-
-        } else if (o instanceof JSONArray) {
-            ja = (JSONArray)o;
-            len = ja.length();
-            for (i = 0; i < len; ++i) {
-                b.append(toString(
-                    ja.opt(i), (tagName == null) ? "array" : tagName));
-            }
-            return b.toString();
-        } else {
-            s = (o == null) ? "null" : escape(o.toString());
-            return (tagName == null) ? "\"" + s + "\"" :
-                (s.length() == 0) ? "<" + tagName + "/>" :
-                "<" + tagName + ">" + s + "</" + tagName + ">";
-        }
-    }
-}
diff --git a/common/src/main/java/json/org/json/XMLTokener.java b/common/src/main/java/json/org/json/XMLTokener.java
deleted file mode 100644
index b86f4bcc8..000000000
--- a/common/src/main/java/json/org/json/XMLTokener.java
+++ /dev/null
@@ -1,292 +0,0 @@
-package json.org.json;
-
-/*
-Copyright (c) 2002 JSON.org
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-The Software shall be used for Good, not Evil.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-*/
-
-/**
- * The XMLTokener extends the JSONTokener to provide additional methods
- * for the parsing of XML texts.
- * @author JSON.org
- * @version 2
- */
-public class XMLTokener extends JSONTokener {
-
-
-   /** The table of entity values. It initially contains Character values for
-    * amp, apos, gt, lt, quot.
-    */
-   public static final java.util.HashMap<String, Character> entity;
-
-   static {
-       entity = new java.util.HashMap<>(8);
-       entity.put("amp",  XML.AMP);
-       entity.put("apos", XML.APOS);
-       entity.put("gt",   XML.GT);
-       entity.put("lt",   XML.LT);
-       entity.put("quot", XML.QUOT);
-   }
-
-    /**
-     * Construct an XMLTokener from a string.
-     * @param s A source string.
-     */
-    public XMLTokener(String s) {
-        super(s);
-    }
-
-    /**
-     * Get the text in the CDATA block.
-     * @return The string up to the <code>]]&gt;</code>.
-     * @throws JSONException If the <code>]]&gt;</code> is not found.
-     */
-    public String nextCDATA() throws JSONException {
-        char         c;
-        int          i;
-        StringBuffer sb = new StringBuffer();
-        for (;;) {
-            c = next();
-            if (c == 0) {
-                throw syntaxError("Unclosed CDATA.");
-            }
-            sb.append(c);
-            i = sb.length() - 3;
-            if (i >= 0 && sb.charAt(i) == ']' &&
-                          sb.charAt(i + 1) == ']' && sb.charAt(i + 2) == '>') {
-                sb.setLength(i);
-                return sb.toString();
-            }
-        }
-    }
-
-
-    /**
-     * Get the next XML outer token, trimming whitespace. There are two kinds
-     * of tokens: the '<' character which begins a markup tag, and the content
-     * text between markup tags.
-     *
-     * @return  A string, or a '<' Character, or null if there is no more
-     * source text.
-     * @throws JSONException
-     */
-    public Object nextContent() throws JSONException {
-        char         c;
-        StringBuffer sb;
-        do {
-            c = next();
-        } while (Character.isWhitespace(c));
-        if (c == 0) {
-            return null;
-        }
-        if (c == '<') {
-            return XML.LT;
-        }
-        sb = new StringBuffer();
-        for (;;) {
-            if (c == '<' || c == 0) {
-                back();
-                return sb.toString().trim();
-            }
-            if (c == '&') {
-                sb.append(nextEntity(c));
-            } else {
-                sb.append(c);
-            }
-            c = next();
-        }
-    }
-
-
-    /**
-     * Return the next entity. These entities are translated to Characters:
-     *     <code>&amp;  &apos;  &gt;  &lt;  &quot;</code>.
-     * @param a An ampersand character.
-     * @return  A Character or an entity String if the entity is not recognized.
-     * @throws JSONException If missing ';' in XML entity.
-     */
-    public Object nextEntity(char a) throws JSONException {
-        StringBuffer sb = new StringBuffer();
-        for (;;) {
-            char c = next();
-            if (Character.isLetterOrDigit(c) || c == '#') {
-                sb.append(Character.toLowerCase(c));
-            } else if (c == ';') {
-                break;
-            } else {
-                throw syntaxError("Missing ';' in XML entity: &" + sb);
-            }
-        }
-        String s = sb.toString();
-        Object e = entity.get(s);
-        return e != null ? e : a + s + ";";
-    }
-
-
-    /**
-     * Returns the next XML meta token. This is used for skipping over <!...>
-     * and <?...?> structures.
-     * @return Syntax characters (<code>< > / = ! ?</code>) are returned as
-     *  Character, and strings and names are returned as Boolean. We don't care
-     *  what the values actually are.
-     * @throws JSONException If a string is not properly closed or if the XML
-     *  is badly structured.
-     */
-    public Object nextMeta() throws JSONException {
-        char c;
-        char q;
-        do {
-            c = next();
-        } while (Character.isWhitespace(c));
-        switch (c) {
-        case 0:
-            throw syntaxError("Misshaped meta tag.");
-        case '<':
-            return XML.LT;
-        case '>':
-            return XML.GT;
-        case '/':
-            return XML.SLASH;
-        case '=':
-            return XML.EQ;
-        case '!':
-            return XML.BANG;
-        case '?':
-            return XML.QUEST;
-        case '"':
-        case '\'':
-            q = c;
-            for (;;) {
-                c = next();
-                if (c == 0) {
-                    throw syntaxError("Unterminated string.");
-                }
-                if (c == q) {
-                    return Boolean.TRUE;
-                }
-            }
-        default:
-            for (;;) {
-                c = next();
-                if (Character.isWhitespace(c)) {
-                    return Boolean.TRUE;
-                }
-                switch (c) {
-                case 0:
-                case '<':
-                case '>':
-                case '/':
-                case '=':
-                case '!':
-                case '?':
-                case '"':
-                case '\'':
-                    back();
-                    return Boolean.TRUE;
-                }
-            }
-        }
-    }
-
-
-    /**
-     * Get the next XML Token. These tokens are found inside of angle
-     * brackets. It may be one of these characters: <code>/ > = ! ?</code> or it
-     * may be a string wrapped in single quotes or double quotes, or it may be a
-     * name.
-     * @return a String or a Character.
-     * @throws JSONException If the XML is not well formed.
-     */
-    public Object nextToken() throws JSONException {
-        char c;
-        char q;
-        StringBuffer sb;
-        do {
-            c = next();
-        } while (Character.isWhitespace(c));
-        switch (c) {
-        case 0:
-            throw syntaxError("Misshaped element.");
-        case '<':
-            throw syntaxError("Misplaced '<'.");
-        case '>':
-            return XML.GT;
-        case '/':
-            return XML.SLASH;
-        case '=':
-            return XML.EQ;
-        case '!':
-            return XML.BANG;
-        case '?':
-            return XML.QUEST;
-
-// Quoted string
-
-        case '"':
-        case '\'':
-            q = c;
-            sb = new StringBuffer();
-            for (;;) {
-                c = next();
-                if (c == 0) {
-                    throw syntaxError("Unterminated string.");
-                }
-                if (c == q) {
-                    return sb.toString();
-                }
-                if (c == '&') {
-                    sb.append(nextEntity(c));
-                } else {
-                    sb.append(c);
-                }
-            }
-        default:
-
-// Name
-
-            sb = new StringBuffer();
-            for (;;) {
-                sb.append(c);
-                c = next();
-                if (Character.isWhitespace(c)) {
-                    return sb.toString();
-                }
-                switch (c) {
-                case 0:
-                case '>':
-                case '/':
-                case '=':
-                case '!':
-                case '?':
-                case '[':
-                case ']':
-                    back();
-                    return sb.toString();
-                case '<':
-                case '"':
-                case '\'':
-                    throw syntaxError("Bad character in a name.");
-                }
-            }
-        }
-    }
-}
diff --git a/gxawsserverless/src/main/java/com/genexus/cloud/serverless/aws/handler/LambdaEventBridgeHandler.java b/gxawsserverless/src/main/java/com/genexus/cloud/serverless/aws/handler/LambdaEventBridgeHandler.java
index 4ef04e940..95f420c19 100644
--- a/gxawsserverless/src/main/java/com/genexus/cloud/serverless/aws/handler/LambdaEventBridgeHandler.java
+++ b/gxawsserverless/src/main/java/com/genexus/cloud/serverless/aws/handler/LambdaEventBridgeHandler.java
@@ -8,7 +8,7 @@
 import com.genexus.cloud.serverless.model.EventMessageResponse;
 import com.genexus.cloud.serverless.model.EventMessageSourceType;
 import com.genexus.cloud.serverless.model.EventMessages;
-import json.org.json.JSONObject;
+import com.genexus.json.JSONObjectWrapper;
 import org.apache.http.client.utils.DateUtils;
 
 import java.util.Map;
@@ -41,7 +41,7 @@ public String handleRequest(Map<String, Object> stringObjectMap, Context context
 			}
 			msgItem.setMessageId(stringObjectMap.getOrDefault("id", "").toString());
 			if (stringObjectMap.containsKey("detail")) {
-				msgItem.setMessageData(new JSONObject(jsonEventRaw).getString("detail"));
+				msgItem.setMessageData(new JSONObjectWrapper(jsonEventRaw).getJSONObject("detail").toString());
 			}
 			for (Map.Entry<String, Object> entry : stringObjectMap.entrySet()) {
 				Helper.addEventMessageProperty(msgItem, entry.getKey(), entry.getValue().toString());
diff --git a/gxcloudstorage-common/src/main/java/com/genexus/db/driver/ExternalProviderMetadata.java b/gxcloudstorage-common/src/main/java/com/genexus/db/driver/ExternalProviderMetadata.java
index 7334a5cf1..0d8a5a96c 100644
--- a/gxcloudstorage-common/src/main/java/com/genexus/db/driver/ExternalProviderMetadata.java
+++ b/gxcloudstorage-common/src/main/java/com/genexus/db/driver/ExternalProviderMetadata.java
@@ -1,7 +1,7 @@
 package com.genexus.db.driver;
 
-import json.org.json.JSONObject;
-import json.org.json.JSONException;
+import com.genexus.json.JSONObjectWrapper;
+import org.json.JSONException;
 
 public class ExternalProviderMetadata
 {
@@ -57,7 +57,7 @@ public String toJson()
 	{
 		try
 		{
-			JSONObject jsonString = new JSONObject();
+			JSONObjectWrapper jsonString = new JSONObjectWrapper();
 			jsonString.put("Provider", new Integer(getProvider()));
 			jsonString.put("Bucket", getBucket());
 			jsonString.put("Folder", getFolder());
@@ -74,8 +74,8 @@ public String toJson()
 	public void fromJson(String jsonString)
 	{
 		try
-		{		
-			JSONObject jsonObject = new JSONObject(jsonString);
+		{
+			JSONObjectWrapper jsonObject = new JSONObjectWrapper(jsonString);
 			setProvider(new Integer((Integer)jsonObject.get("Provider")).intValue());
 			setBucket((String)jsonObject.get("Bucket"));
 			setFolder((String)jsonObject.get("Folder"));
diff --git a/gxcosmosdb/src/main/java/com/genexus/db/cosmosdb/CosmosDBHelper.java b/gxcosmosdb/src/main/java/com/genexus/db/cosmosdb/CosmosDBHelper.java
index b16b27425..ef08d4d33 100644
--- a/gxcosmosdb/src/main/java/com/genexus/db/cosmosdb/CosmosDBHelper.java
+++ b/gxcosmosdb/src/main/java/com/genexus/db/cosmosdb/CosmosDBHelper.java
@@ -4,8 +4,8 @@
 import com.genexus.db.ServiceCursorBase;
 import com.genexus.db.service.GXType;
 import com.genexus.db.service.VarValue;
-import json.org.json.JSONException;
-import json.org.json.JSONObject;
+import org.json.JSONException;
+import com.genexus.json.JSONObjectWrapper;
 import java.sql.SQLException;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
@@ -217,12 +217,12 @@ else if (parm.type == GXType.Date) {
 		}
 		return false;
 	}
-	public static JSONObject addItemValue(String name, VarValue parm, JSONObject jsonObject) throws JSONException, SQLException {
+	public static JSONObjectWrapper addItemValue(String name, VarValue parm, JSONObjectWrapper jsonObject) throws JSONException, SQLException {
 		if (parm == null) {
 			throw new SQLException(String.format("Cannot assign attribute value (name: %s)", name));
 		}
 		if (jsonObject == null)
-			jsonObject = new JSONObject();
+			jsonObject = new JSONObjectWrapper();
 		if (parm.value!= null) {
 			String[] dateStr = new String[1];
 			if (tryConvertToDateISOFormat(parm, dateStr))
@@ -237,7 +237,7 @@ public static JSONObject addItemValue(String name, VarValue parm, JSONObject jso
 				jsonObject.put(name, parm.value);
 		}
 		else
-			jsonObject.put(name, JSONObject.NULL);
+			jsonObject.put(name, JSONObjectWrapper.NULL);
 		return jsonObject;
 	}
 }
diff --git a/gxcosmosdb/src/main/java/com/genexus/db/cosmosdb/CosmosDBPreparedStatement.java b/gxcosmosdb/src/main/java/com/genexus/db/cosmosdb/CosmosDBPreparedStatement.java
index 1bd8f9144..719564eb8 100644
--- a/gxcosmosdb/src/main/java/com/genexus/db/cosmosdb/CosmosDBPreparedStatement.java
+++ b/gxcosmosdb/src/main/java/com/genexus/db/cosmosdb/CosmosDBPreparedStatement.java
@@ -16,8 +16,8 @@
 import com.genexus.diagnostics.core.ILogger;
 import com.genexus.diagnostics.core.LogManager;
 import com.genexus.util.NameValuePair;
-import json.org.json.JSONException;
-import json.org.json.JSONObject;
+import org.json.JSONException;
+import com.genexus.json.JSONObjectWrapper;
 import reactor.core.Disposable;
 import reactor.core.publisher.Mono;
 
@@ -65,7 +65,7 @@ public ResultSet executeQuery() throws SQLException
 	private int _executeQuery(CosmosDBResultSet resultSet) throws Exception {
 		query.initializeParms(parms);
 		boolean isUpdate = query.getQueryType() == QueryType.UPD;
-		JSONObject jsonObject = setUpJsonPayload(isUpdate);
+		JSONObjectWrapper jsonObject = setUpJsonPayload(isUpdate);
 
 		switch (query.getQueryType())
 		{
@@ -253,7 +253,7 @@ private int[] deleteDocument(String idValue, Object partitionKey) throws Excepti
 			throw new Exception("CosmosDB Delete Execution failed. Container not found.");
 		}
 	}
-	private int[] createDocument(JSONObject jsonObject, Object partitionKey) throws Exception {
+	private int[] createDocument(JSONObjectWrapper jsonObject, Object partitionKey) throws Exception {
 
 		int[] statusCode = new int[1];
 		if (container != null) {
@@ -289,7 +289,7 @@ private int[] createDocument(JSONObject jsonObject, Object partitionKey) throws
 			throw new Exception("CosmosDB Insert Execution failed. Container not found.");
 		}
 	}
-	private int[] replaceDocument(JSONObject jsonObject, String idValue , Object partitionKey) throws Exception {
+	private int[] replaceDocument(JSONObjectWrapper jsonObject, String idValue , Object partitionKey) throws Exception {
 		int[] statusCode = new int[1];
 		if (container != null)
 		{
@@ -337,11 +337,11 @@ private void getVarValuesFromQuery(String varName, String name, Query query)
 		if (varValue != null)
 			keyCondition.put(name, varValue.value);
 	}
-	private JSONObject setUpJsonPayload(boolean isUpdate) throws JSONException, SQLException {
+	private JSONObjectWrapper setUpJsonPayload(boolean isUpdate) throws JSONException, SQLException {
 		// Setup the json payload to execute the insert or update query.
 
 		HashMap<String, Object> values = null;
-		JSONObject jsonObject = null;
+		JSONObjectWrapper jsonObject = null;
 
 		for (Iterator<NameValuePair> it = query.getAssignAtts(); it.hasNext(); ) {
 			NameValuePair asg = it.next();
diff --git a/gxdynamodb/src/main/java/com/genexus/db/dynamodb/DynamoDBHelper.java b/gxdynamodb/src/main/java/com/genexus/db/dynamodb/DynamoDBHelper.java
index ca34af579..b75c0d96e 100644
--- a/gxdynamodb/src/main/java/com/genexus/db/dynamodb/DynamoDBHelper.java
+++ b/gxdynamodb/src/main/java/com/genexus/db/dynamodb/DynamoDBHelper.java
@@ -1,8 +1,8 @@
 package com.genexus.db.dynamodb;
 
 import com.genexus.db.service.VarValue;
-import json.org.json.JSONArray;
-import json.org.json.JSONObject;
+import org.json.JSONArray;
+import com.genexus.json.JSONObjectWrapper;
 import software.amazon.awssdk.core.SdkBytes;
 import software.amazon.awssdk.services.dynamodb.model.AttributeValue;
 
@@ -87,7 +87,7 @@ else if (!attValue.ss().isEmpty())
 		else if(attValue.bool() != null)
 			return attValue.bool().toString();
 		else if (attValue.hasM())
-			return new JSONObject(convertToDictionary(attValue.m())).toString();
+			return new JSONObjectWrapper(convertToDictionary(attValue.m())).toString();
 		else if (attValue.hasL())
 			return new JSONArray(attValue.l().stream().map(DynamoDBHelper::getString).collect(Collectors.toList())).toString();
 		return null;
diff --git a/gxgeospatial/pom.xml b/gxgeospatial/pom.xml
index da4f5faab..96f73c8c8 100644
--- a/gxgeospatial/pom.xml
+++ b/gxgeospatial/pom.xml
@@ -19,11 +19,6 @@
 			<artifactId>gxclassR</artifactId>
 			<version>${project.version}</version>
 		</dependency>		
-		<dependency>
-			<groupId>org.json</groupId>
-			<artifactId>json</artifactId>
-			<version>20231013</version>
-		</dependency>		
 		<dependency>
 			<groupId>org.locationtech.spatial4j</groupId>
 			<artifactId>spatial4j</artifactId>
diff --git a/gxgeospatial/src/main/java/com/genexus/GXGeospatial.java b/gxgeospatial/src/main/java/com/genexus/GXGeospatial.java
index 973cb1dd8..80916ad67 100644
--- a/gxgeospatial/src/main/java/com/genexus/GXGeospatial.java
+++ b/gxgeospatial/src/main/java/com/genexus/GXGeospatial.java
@@ -19,7 +19,7 @@
 import net.sf.geographiclib.PolygonArea;
 import net.sf.geographiclib.PolygonResult;
 import net.sf.geographiclib.Geodesic;
-import org.json.JSONObject;
+import com.genexus.json.JSONObjectWrapper;
 import org.json.JSONArray;
 import org.json.JSONException;
 
@@ -324,7 +324,7 @@ public double area()
 			PolygonArea pArea = new PolygonArea( Geodesic.WGS84 , false);
 			String geojson = this.toGeoJSON();	
 			try{
-				JSONObject obj = new JSONObject(geojson);
+				JSONObjectWrapper obj = new JSONObjectWrapper(geojson);
 				JSONArray points = obj.getJSONArray("coordinates").getJSONArray(0);
 				for (int i = 0; i < points.length(); i++) 
 				{
diff --git a/gxmaps/src/main/java/com/genexus/gxmaps/GXMaps.java b/gxmaps/src/main/java/com/genexus/gxmaps/GXMaps.java
index c1bb50d00..d7ca19ca8 100644
--- a/gxmaps/src/main/java/com/genexus/gxmaps/GXMaps.java
+++ b/gxmaps/src/main/java/com/genexus/gxmaps/GXMaps.java
@@ -10,11 +10,6 @@
 import com.genexus.xml.GXXMLSerializable;
 import com.genexus.ClientContext;
 
-
-import org.json.JSONObject;
-import org.json.JSONArray;
-import org.json.JSONException;
-
 public class GXMaps {
 
     public static Double getLatitude(GXGeospatial Point) {
diff --git a/gxmaps/src/main/java/com/genexus/gxmaps/LocationInfo.java b/gxmaps/src/main/java/com/genexus/gxmaps/LocationInfo.java
index aaed57aac..c4f7b7388 100644
--- a/gxmaps/src/main/java/com/genexus/gxmaps/LocationInfo.java
+++ b/gxmaps/src/main/java/com/genexus/gxmaps/LocationInfo.java
@@ -9,12 +9,13 @@
 import java.util.*;
 import com.genexus.xml.*;
 
-import json.org.json.*;
+import org.json.JSONException;
+import com.genexus.json.JSONObjectWrapper;
 import com.genexus.internet.IGxJSONAble;
 
 public final class LocationInfo implements java.io.Serializable, IGxJSONAble {
 
-	protected JSONObject jsonObj = new JSONObject();
+	protected JSONObjectWrapper jsonObj = new JSONObjectWrapper();
 	
 	
 	private GXGeospatial location;
@@ -129,9 +130,9 @@ public Object GetJSONObject()
 		return jsonObj;
 	}
   
-	public void FromJSONObject(IJsonFormattable obj)
+	public void FromJSONObject(Object obj)
 	{
-		JSONObject jObj = (JSONObject) obj;	
+		JSONObjectWrapper jObj = (JSONObjectWrapper) obj;
 		this.setDescription( jObj.optString("description"));
 		this.setHeading( jObj.optDouble("heading"));
 		this.setSpeed( jObj.optDouble("speed"));
@@ -144,7 +145,7 @@ public boolean fromJSonString(String s)
 	{
 		try
 		{
-			jsonObj = new JSONObject(s);
+			jsonObj = new JSONObjectWrapper(s);
 			FromJSONObject(jsonObj);
 			return true;
 		}
diff --git a/gxsearch/src/main/java/com/genexus/search/SearchResultItem.java b/gxsearch/src/main/java/com/genexus/search/SearchResultItem.java
index a4f0a7cb7..0644a6dd2 100644
--- a/gxsearch/src/main/java/com/genexus/search/SearchResultItem.java
+++ b/gxsearch/src/main/java/com/genexus/search/SearchResultItem.java
@@ -5,9 +5,8 @@
 import java.text.ParseException;
 import com.genexus.internet.StringCollection;
 
-import json.org.json.IJsonFormattable;
-import json.org.json.JSONException;
-import json.org.json.JSONObject;
+import org.json.JSONException;
+import com.genexus.json.JSONObjectWrapper;
 
 import org.apache.lucene.document.DateField;
 import org.apache.lucene.document.DateTools;
@@ -26,19 +25,19 @@ public class SearchResultItem implements ISearchResultItem, Serializable, IGxJSO
 	private static final long serialVersionUID = 1L;
 	private Document m_document;
 	private float m_score;
-    private JSONObject _Properties;
+    private JSONObjectWrapper _Properties;
 
     public SearchResultItem() {
-        _Properties = new JSONObject();
+        _Properties = new JSONObjectWrapper();
     }
 
 	protected SearchResultItem(Document doc, float score)
 	{
-            _Properties = new JSONObject();
+            _Properties = new JSONObjectWrapper();
 		m_document = doc;
 		m_score = score;
 	}
-        public JSONObject GetProperties()
+        public JSONObjectWrapper GetProperties()
         {
             return _Properties;
         }
@@ -114,7 +113,7 @@ public Object GetJSONObject()
             return _Properties;
         }
 
-        public void FromJSONObject(IJsonFormattable obj) {
+        public void FromJSONObject(Object obj) {
         }
         public void AddObjectProperty(String name, Object prop)
         {
diff --git a/gxspringboot/src/main/java/com/genexus/springboot/GxSpringBootRestService.java b/gxspringboot/src/main/java/com/genexus/springboot/GxSpringBootRestService.java
index ecb9a82b9..19d3a9ecc 100644
--- a/gxspringboot/src/main/java/com/genexus/springboot/GxSpringBootRestService.java
+++ b/gxspringboot/src/main/java/com/genexus/springboot/GxSpringBootRestService.java
@@ -1,8 +1,8 @@
 package com.genexus.springboot;
 
 import com.genexus.GxRestService;
-import json.org.json.JSONException;
-import json.org.json.JSONObject;
+import org.json.JSONException;
+import com.genexus.json.JSONObjectWrapper;
 import org.apache.logging.log4j.Logger;
 import org.springframework.http.*;
 import org.springframework.web.bind.annotation.*;
@@ -14,7 +14,7 @@ abstract public class GxSpringBootRestService extends GxRestService {
 	@ExceptionHandler(Exception.class)
 	protected ResponseEntity<Object> handleException(Exception ex) {
 		log.error("Error executing REST service", ex);
-		JSONObject errorJson = new JSONObject();
+		JSONObjectWrapper errorJson = new JSONObjectWrapper();
 		int errCode = 500;
 		String errMessage = "Internal Server Error";
 		HttpStatus statusCode = HttpStatus.INTERNAL_SERVER_ERROR;
@@ -27,7 +27,7 @@ protected ResponseEntity<Object> handleException(Exception ex) {
 
 		try
 		{
-			JSONObject obj = new JSONObject();
+			JSONObjectWrapper obj = new JSONObjectWrapper();
 			obj.put("code", errCode);
 			obj.put("message", errMessage);
 			errorJson.put("error", obj);
diff --git a/gxweb/src/main/java/com/genexus/internet/HttpAjaxContext.java b/gxweb/src/main/java/com/genexus/internet/HttpAjaxContext.java
index 4ce3ff9e4..efd9a2883 100644
--- a/gxweb/src/main/java/com/genexus/internet/HttpAjaxContext.java
+++ b/gxweb/src/main/java/com/genexus/internet/HttpAjaxContext.java
@@ -22,10 +22,9 @@
 
 import com.genexus.webpanels.HttpContextWeb;
 import com.genexus.webpanels.WebUtils;
-import json.org.json.IJsonFormattable;
-import json.org.json.JSONArray;
-import json.org.json.JSONException;
-import json.org.json.JSONObject;
+import org.json.JSONArray;
+import org.json.JSONException;
+import com.genexus.json.JSONObjectWrapper;
 
 public class HttpAjaxContext extends HttpContextWeb
 {
@@ -38,13 +37,13 @@ public class HttpAjaxContext extends HttpContextWeb
 	public static final ILogger logger = LogManager.getLogger(HttpAjaxContext.class);
 	private JSONArray AttValues = new JSONArray();
 	private JSONArray PropValues = new JSONArray();
-	protected JSONObject HiddenValues = new JSONObject();
-	protected JSONObject Messages = new JSONObject();
-	private JSONObject WebComponents = new JSONObject();
-	private Hashtable<Integer, JSONObject> LoadCommands = new Hashtable<>();
+	protected JSONObjectWrapper HiddenValues = new JSONObjectWrapper();
+	protected JSONObjectWrapper Messages = new JSONObjectWrapper();
+	private JSONObjectWrapper WebComponents = new JSONObjectWrapper();
+	private Hashtable<Integer, JSONObjectWrapper> LoadCommands = new Hashtable<>();
 	private ArrayList Grids = new ArrayList();
 	private Hashtable<String, Integer> DicGrids = new Hashtable<String, Integer>();
-	private JSONObject ComponentObjects = new JSONObject();
+	private JSONObjectWrapper ComponentObjects = new JSONObjectWrapper();
 	protected GXAjaxCommandCollection commands = new GXAjaxCommandCollection();
 	protected IGXWebRow _currentGridRow = null;
 	protected JSONArray StylesheetsToLoad = new JSONArray();
@@ -218,7 +217,7 @@ public void doAjaxLoad(int SId, IGXWebRow row)
 	{
 		try
 		{
-			JSONObject JSONRow = new JSONObject();
+			JSONObjectWrapper JSONRow = new JSONObjectWrapper();
 			JSONRow.put("grid", SId);
 			JSONRow.put("props", row.getParentGrid().GetJSONObject());
 			JSONRow.put("values", row.getParentGrid().GetValues());
@@ -233,7 +232,7 @@ public void doAjaxAddLines(int SId, int lines)
 	{
 		try
 		{
-			JSONObject JSONData = new JSONObject();
+			JSONObjectWrapper JSONData = new JSONObjectWrapper();
 			JSONData.put("grid", SId);
 			JSONData.put("count", lines);
 			appendAjaxCommand("addlines", JSONData);
@@ -279,7 +278,7 @@ public void appendAjaxCommand(String cmdType, Object cmdData) throws JSONExcepti
 		commands.AppendCommand(new GXAjaxCommand(cmdType, cmdData));
 	}
 
-	public void appendLoadData(int SId, JSONObject Data) throws JSONException
+	public void appendLoadData(int SId, JSONObjectWrapper Data) throws JSONException
 	{
 		LoadCommands.put(SId, Data);
 	}
@@ -292,7 +291,7 @@ public void executeUsercontrolMethod(String CmpContext, boolean IsMasterPage, St
 
 	public void setExternalObjectProperty(String CmpContext, boolean IsMasterPage, String containerName, String propertyName, Object value)
 	{
-			JSONObject obj = new JSONObject();
+		JSONObjectWrapper obj = new JSONObjectWrapper();
 			try
 			{
 				obj.put("CmpContext", CmpContext);
@@ -307,7 +306,7 @@ public void setExternalObjectProperty(String CmpContext, boolean IsMasterPage, S
 
 	public void executeExternalObjectMethod(String CmpContext, boolean IsMasterPage, String containerName, String methodName, Object[] parms, boolean isEvent)
 	{
-			JSONObject obj = new JSONObject();
+		JSONObjectWrapper obj = new JSONObjectWrapper();
 			try
 			{
 				obj.put("CmpContext", CmpContext);
@@ -333,7 +332,7 @@ public void printReportAtClient(String reportFile, String printerRule)
 
 	protected void addPrintReportCommand(String reportFile, String printerRule)
 	{
-		JSONObject obj = new JSONObject();
+		JSONObjectWrapper obj = new JSONObjectWrapper();
 		try
 		{
 			obj.put("reportFile", reportFile);
@@ -516,7 +515,7 @@ public void SendState()
 		AddStylesheetsToLoad();
 		if (isSpaRequest())
 		{
-			writeTextNL("<script>gx.ajax.saveJsonResponse(" + WebUtils.htmlEncode(JSONObject.quote(getJSONResponse()), true) + ");</script>");
+			writeTextNL("<script>gx.ajax.saveJsonResponse(" + WebUtils.htmlEncode(JSONObjectWrapper.quote(getJSONResponse()), true) + ");</script>");
 		}
 		else
 		{
@@ -803,21 +802,21 @@ public boolean IsSameComponent(String oldName, String newName)
 		return false;
 	}
 
-	private JSONObject getGxObject(JSONArray array, String CmpContext, boolean IsMasterPage)
+	private JSONObjectWrapper getGxObject(JSONArray array, String CmpContext, boolean IsMasterPage)
 	{
 		try
 		{
-			JSONObject obj;
+			JSONObjectWrapper obj;
 			int len = array.length();
 			for(int i=0; i<len; i++)
 			{
-				obj = array.getJSONObject(i);
+				obj = new JSONObjectWrapper(array.getJSONObject(i));
 				if (obj.getBoolean("IsMasterPage") == IsMasterPage &&  obj.getString("CmpContext").equals(CmpContext))
 				{
 					return obj;
 				}
 			}
-			obj = new JSONObject();
+			obj = new JSONObjectWrapper();
 			obj.put("CmpContext", CmpContext);
 			obj.put("IsMasterPage", new Boolean(IsMasterPage).toString());
 			array.put(obj);
@@ -836,7 +835,7 @@ public void ajax_rsp_assign_attri( String CmpContext, boolean IsMasterPage, Stri
 			if (!isSpaRequest() || (isSpaRequest() && (CmpContext == null || CmpContext.trim().length() == 0)))
 			{
 				try {
-					JSONObject obj = getGxObject(AttValues, CmpContext, IsMasterPage);
+					JSONObjectWrapper obj = getGxObject(AttValues, CmpContext, IsMasterPage);
 					if (obj != null)
 					{
 						obj.put(AttName, AttValue);
@@ -867,7 +866,7 @@ public void ajax_rsp_assign_sdt_attri( String CmpContext, boolean IsMasterPage,
                 if (!isSpaRequest() || (isSpaRequest() && (CmpContext == null || CmpContext.trim().length() == 0)))
                 {
                   try {
-                      JSONObject obj = getGxObject(AttValues, CmpContext, IsMasterPage);
+					  JSONObjectWrapper obj = getGxObject(AttValues, CmpContext, IsMasterPage);
 					  if (obj != null && (!isUndefinedOutParam( AttName, SdtObj) || dynAjaxEventContext.isParmModified(AttName, SdtObj)))
 					  {
                         if (SdtObj instanceof IGxJSONAble)
@@ -893,13 +892,13 @@ public String ajax_rspGetHiddens()
             return HiddenValues.toString();
         }
 
-        private JSONObject getControlProps(JSONObject obj, String Control)
+        private JSONObjectWrapper getControlProps(JSONObjectWrapper obj, String Control)
         {
-            JSONObject ctrlProps = null;
+			JSONObjectWrapper ctrlProps = null;
             try {
-                ctrlProps = obj.optJSONObject(Control);
+                ctrlProps = new JSONObjectWrapper(obj.optJSONObject(Control));
                 if (ctrlProps == null) {
-                    ctrlProps = new JSONObject();
+                    ctrlProps = new JSONObjectWrapper();
                     obj.put(Control, ctrlProps);
                 }
             } catch (JSONException e) {
@@ -931,10 +930,10 @@ public void ajax_rsp_assign_prop( String CmpContext, boolean IsMasterPage, Strin
                         {
                             formCaption = Value;
                         }
-                        JSONObject obj = getGxObject(PropValues, CmpContext, IsMasterPage);
+						JSONObjectWrapper obj = getGxObject(PropValues, CmpContext, IsMasterPage);
                         if (obj != null)
                         {
-                            JSONObject ctrlProps = getControlProps(obj, Control);
+							JSONObjectWrapper ctrlProps = getControlProps(obj, Control);
                             if (ctrlProps != null)
                             {
                             ctrlProps.put(Property, Value);
@@ -1329,7 +1328,7 @@ public void writeTextNL(String text)
 	public void ajax_rsp_command_close() {
 		bCloseCommand = true;
 		try {
-			JSONObject closeParms = new JSONObject();
+			JSONObjectWrapper closeParms = new JSONObjectWrapper();
 			closeParms.put("values", ObjArrayToJSONArray(this.getWebReturnParms()));
 			closeParms.put("metadata", ObjArrayToJSONArray(this.getWebReturnParmsMetadata()));
 			appendAjaxCommand("close", closeParms);
@@ -1368,7 +1367,7 @@ public void redirect_impl(String url, IGXWindow win) {
 				if (win != null) {
 					appendAjaxCommand("popup", win.GetJSONObject());
 				} else if (!Redirected) {
-					JSONObject jsonCmd = new JSONObject();
+					JSONObjectWrapper jsonCmd = new JSONObjectWrapper();
 					jsonCmd.put("url", url);
 					if (this.wjLocDisableFrm > 0) {
 						jsonCmd.put("forceDisableFrm", this.wjLocDisableFrm);
@@ -1613,9 +1612,9 @@ public Object getData()
 				return data;
 		}
 
-		public JSONObject getJSONObject()
+		public JSONObjectWrapper getJSONObject()
 		{
-				JSONObject jObj = new JSONObject();
+			JSONObjectWrapper jObj = new JSONObjectWrapper();
 				try {
 					jObj.put(type, data);
 				} catch (JSONException ex) {
@@ -1655,11 +1654,11 @@ public String toString()
 
 	public class GXUsercontrolMethod implements IGxJSONAble
 	{
-		JSONObject wrapper;
+		JSONObjectWrapper wrapper;
 
 		public GXUsercontrolMethod(String CmpContext, boolean IsMasterPage, String containerName, String methodName, String output, Object[] parms)
 		{
-			wrapper = new JSONObject();
+			wrapper = new JSONObjectWrapper();
 			AddObjectProperty("CmpContext", CmpContext);
 			AddObjectProperty("IsMasterPage", new Boolean(IsMasterPage));
 			AddObjectProperty("Control", containerName);
@@ -1705,7 +1704,7 @@ public Object GetJSONObject()
 			return wrapper;
 		}
 
-		public void FromJSONObject(IJsonFormattable obj)
+		public void FromJSONObject(Object obj)
 		{
 		}
 
diff --git a/gxweb/src/main/java/com/genexus/security/web/SecureToken.java b/gxweb/src/main/java/com/genexus/security/web/SecureToken.java
index eb94d9ad0..91a5b808d 100644
--- a/gxweb/src/main/java/com/genexus/security/web/SecureToken.java
+++ b/gxweb/src/main/java/com/genexus/security/web/SecureToken.java
@@ -3,8 +3,6 @@
 
 import com.genexus.internet.IGxJSONAble;
 
-import json.org.json.IJsonFormattable;
-
 public abstract class SecureToken implements IGxJSONAble{	
 	public void tojson()
 	{
@@ -25,7 +23,7 @@ public Object GetJSONObject(boolean includeState)
     	throw new NotImplementedException();
     }
     
-    public void FromJSONObject(IJsonFormattable obj)
+    public void FromJSONObject(Object obj)
     {
     	throw new NotImplementedException();
     }
diff --git a/gxweb/src/main/java/com/genexus/security/web/SecureTokenHelper.java b/gxweb/src/main/java/com/genexus/security/web/SecureTokenHelper.java
index 2283615a5..118c2d508 100644
--- a/gxweb/src/main/java/com/genexus/security/web/SecureTokenHelper.java
+++ b/gxweb/src/main/java/com/genexus/security/web/SecureTokenHelper.java
@@ -11,7 +11,7 @@
 import com.genexus.security.web.jose.jwt.JWTSigner;
 import com.genexus.security.web.jose.jwt.JWTVerifier;
 
-import json.org.json.JSONObject;
+import com.genexus.json.JSONObjectWrapper;
 
 public class SecureTokenHelper {
 	
@@ -65,7 +65,7 @@ public static boolean verify(String jwtToken, SecureToken outToken, String secre
 		{							
         	try {
 				Map<String,Object> mapObj = verifier.verify(jwtToken);
-				JSONObject jObj = new JSONObject(mapObj);
+				JSONObjectWrapper jObj = new JSONObjectWrapper(mapObj);
 				outToken.FromJSONObject(jObj);
 				ok = true;			
 			}
diff --git a/gxweb/src/main/java/com/genexus/security/web/WebSecureToken.java b/gxweb/src/main/java/com/genexus/security/web/WebSecureToken.java
index cece09808..9d87787a6 100644
--- a/gxweb/src/main/java/com/genexus/security/web/WebSecureToken.java
+++ b/gxweb/src/main/java/com/genexus/security/web/WebSecureToken.java
@@ -4,9 +4,8 @@
 
 import org.apache.commons.lang.StringUtils;
 
-import json.org.json.IJsonFormattable;
-import json.org.json.JSONException;
-import json.org.json.JSONObject;
+import org.json.JSONException;
+import com.genexus.json.JSONObjectWrapper;
 
 public class WebSecureToken extends SecureToken {
 	private static int TOKEN_DAYS_EXPIRATION = 15;
@@ -20,7 +19,7 @@ public class WebSecureToken extends SecureToken {
 	private String _value = "";
 	private Date _expiration;
 	
-	private JSONObject _jObj = new JSONObject();
+	private JSONObjectWrapper _jObj = new JSONObjectWrapper();
 	
 	public WebSecureToken(){			
 		_expiration = org.apache.commons.lang.time.DateUtils.addDays(new Date(), TOKEN_DAYS_EXPIRATION);
@@ -90,9 +89,9 @@ public Object GetJSONObject(boolean includeState)
     	return GetJSONObject();
     }
     
-    public void FromJSONObject(IJsonFormattable obj)
+    public void FromJSONObject(Object obj)
     {
-    	JSONObject jObj = (JSONObject) obj;			
+		JSONObjectWrapper jObj = (JSONObjectWrapper) obj;
 		this._issuer = getJsonPtyValueString(jObj, WebSecureToken.JSON_ISSUER_NAME);
 		this._value = getJsonPtyValueString(jObj, WebSecureToken.JSON_VALUE_NAME);
 		this._pgmName = getJsonPtyValueString(jObj, WebSecureToken.JSON_PGMNAME_NAME);
@@ -107,7 +106,7 @@ public String ToJavascriptSource()
     	return GetJSONObject().toString();
     }   
     
-    private String getJsonPtyValueString(JSONObject jObj, String name)
+    private String getJsonPtyValueString(JSONObjectWrapper jObj, String name)
     {
     	if (jObj.has(name))
 			try {
diff --git a/gxweb/src/main/java/com/genexus/webpanels/DynAjaxEventContext.java b/gxweb/src/main/java/com/genexus/webpanels/DynAjaxEventContext.java
index 23943d196..27e260030 100644
--- a/gxweb/src/main/java/com/genexus/webpanels/DynAjaxEventContext.java
+++ b/gxweb/src/main/java/com/genexus/webpanels/DynAjaxEventContext.java
@@ -2,7 +2,7 @@
 
 import com.genexus.GXutil;
 import com.genexus.internet.IGxJSONSerializable;
-import json.org.json.JSONArray;
+import org.json.JSONArray;
 
 import java.util.HashSet;
 import java.util.Hashtable;
diff --git a/gxweb/src/main/java/com/genexus/webpanels/GXWebColumn.java b/gxweb/src/main/java/com/genexus/webpanels/GXWebColumn.java
index 37cffdbe4..0733cf129 100644
--- a/gxweb/src/main/java/com/genexus/webpanels/GXWebColumn.java
+++ b/gxweb/src/main/java/com/genexus/webpanels/GXWebColumn.java
@@ -2,20 +2,19 @@
 
 import com.genexus.internet.IGxJSONAble;
 
-import json.org.json.IJsonFormattable;
-import json.org.json.JSONException;
-import json.org.json.JSONObject;
+import org.json.JSONException;
+import com.genexus.json.JSONObjectWrapper;
 
 public class GXWebColumn implements IGxJSONAble
 {
-	private JSONObject _Properties;
+	private JSONObjectWrapper _Properties;
 
     public GXWebColumn()
     {
-        _Properties = new JSONObject();
+        _Properties = new JSONObjectWrapper();
     }
 
-    public JSONObject GetProperties()
+    public JSONObjectWrapper GetProperties()
     {
         return _Properties;
     }
@@ -66,6 +65,6 @@ public Object GetJSONObject()
         return _Properties;
     }
 
-    public void FromJSONObject(IJsonFormattable obj) {
+    public void FromJSONObject(Object obj) {
     }
 }
diff --git a/gxweb/src/main/java/com/genexus/webpanels/GXWebGrid.java b/gxweb/src/main/java/com/genexus/webpanels/GXWebGrid.java
index 45c32ec30..e82b2829a 100644
--- a/gxweb/src/main/java/com/genexus/webpanels/GXWebGrid.java
+++ b/gxweb/src/main/java/com/genexus/webpanels/GXWebGrid.java
@@ -8,10 +8,9 @@
 import com.genexus.internet.IGxJSONAble;
 import com.genexus.common.interfaces.IGXWebGrid;
 
-import json.org.json.IJsonFormattable;
-import json.org.json.JSONArray;
-import json.org.json.JSONException;
-import json.org.json.JSONObject;
+import org.json.JSONArray;
+import org.json.JSONException;
+import com.genexus.json.JSONObjectWrapper;
 
 public class GXWebGrid implements IGxJSONAble, IGXWebGrid
 {
@@ -19,7 +18,7 @@ public class GXWebGrid implements IGxJSONAble, IGXWebGrid
     boolean wrapped;
     boolean isFreestyle;
     JSONArray _ColsProps;
-    JSONObject _Rows;
+	JSONObjectWrapper _Rows;
     int _Count;
     ArrayList<GXWebRow> _rowObjs;
 	ArrayList<JSONArray> _ColsPropsCommon;
@@ -28,7 +27,7 @@ public class GXWebGrid implements IGxJSONAble, IGXWebGrid
 
     public GXWebGrid()
     {
-        _Rows = new JSONObject();
+        _Rows = new JSONObjectWrapper();
         _ColsProps = new JSONArray();
         _rowObjs = new ArrayList<>();
 		_ColsPropsCommon = new ArrayList<>();
@@ -232,7 +231,7 @@ public Object GetJSONObject()
         return _Rows;
     }
 
-    public void FromJSONObject(IJsonFormattable obj)
+    public void FromJSONObject(Object obj)
     {
     }
 }
diff --git a/gxweb/src/main/java/com/genexus/webpanels/GXWebPanel.java b/gxweb/src/main/java/com/genexus/webpanels/GXWebPanel.java
index dd71a86a5..6dc8aca8a 100644
--- a/gxweb/src/main/java/com/genexus/webpanels/GXWebPanel.java
+++ b/gxweb/src/main/java/com/genexus/webpanels/GXWebPanel.java
@@ -23,10 +23,10 @@
 
 import com.genexus.security.web.SecureTokenHelper;
 import com.genexus.security.web.WebSecurityHelper;
-import json.org.json.IJsonFormattable;
-import json.org.json.JSONArray;
-import json.org.json.JSONException;
-import json.org.json.JSONObject;
+import org.json.JSONArray;
+import org.json.JSONException;
+import com.genexus.json.JSONObjectWrapper;
+import org.json.JSONObject;
 import org.apache.commons.lang.StringUtils;
 
 class DataIntegrityException extends Exception
@@ -524,7 +524,7 @@ protected class DynAjaxEvent {
 
 		private void parseInputJSonMessage(String jsonMessage, GXWebPanel targetObj) throws JSONException {
 			try {
-				JSONObject objMessage = new JSONObject(jsonMessage);
+				JSONObjectWrapper objMessage = new JSONObjectWrapper(jsonMessage);
 				if (objMessage.has("parms"))
 					inParmsValues = objMessage.getJSONArray("parms");
 				if (objMessage.has("hsh"))
@@ -550,7 +550,7 @@ private void parseInputJSonMessage(String jsonMessage, GXWebPanel targetObj) thr
 					}
 				}
 				if (objMessage.has("grids"))
-					parseGridsDataParms((JSONObject) objMessage.get("grids"));
+					parseGridsDataParms((JSONObjectWrapper) objMessage.get("grids"));
 				if (objMessage.has("grid"))
 					grid = objMessage.getInt("grid");
 				else
@@ -573,14 +573,14 @@ private void parseInputJSonMessage(String jsonMessage, GXWebPanel targetObj) thr
 			}
 		}
 
-		private void parseGridsDataParms(JSONObject gxGrids)
+		private void parseGridsDataParms(JSONObjectWrapper gxGrids)
 		{
 			JSONArray gridNames = gxGrids.names();
 			if (gridNames != null)
 			{
 				for (int i = 0; i < gridNames.length(); i++) {
 					try {
-						JSONObject grid = (JSONObject)gxGrids.get(gridNames.getString(i));
+						JSONObjectWrapper grid = (JSONObjectWrapper)gxGrids.get(gridNames.getString(i));
 						if (grid.getInt("id") != 0 && !grid.getString("lastRow").equals(""))
 						{
 							int lastRow = grid.getInt("lastRow") + 1;
@@ -664,7 +664,7 @@ private void parseMetadata() {
 				for (int i=0; i< events.length(); i++ )
 				{
 					String eventName = events.getString(i);
-					JSONObject eventMetadata = new JSONObject(targetObj.eventsMetadata.get(eventName));
+					JSONObjectWrapper eventMetadata = new JSONObjectWrapper(targetObj.eventsMetadata.get(eventName));
 					eventHandlers[eventCount] = eventMetadata.getString("handler");
 					JSONArray eventInputParms = eventMetadata.getJSONArray("iparms");
 					for (int j=0; j< eventInputParms.length(); j++ )
@@ -684,7 +684,7 @@ private void parseMetadata() {
 			}
 		}
 
-		private void SetNullableScalarOrCollectionValue(JSONObject parm, Object value, JSONArray columnValues) throws JSONException, Exception
+		private void SetNullableScalarOrCollectionValue(JSONObjectWrapper parm, Object value, JSONArray columnValues) throws JSONException, Exception
 		{
 			String nullableAttribute = parm.optString("nullAv", null);
 			if (nullableAttribute != null && value.toString().length() == 0)
@@ -751,7 +751,7 @@ private void SetCollectionFieldValue(String fieldName, JSONArray values)  throws
             if (field != null)
             {
 				Class[] cArg = new Class[1];
-				cArg[0] = IJsonFormattable.class;
+				cArg[0] = Object.class;
    				Method mth = field.getType().getMethod("FromJSONObject", cArg);
                 if (mth != null)
                 {
@@ -776,9 +776,9 @@ private void SetFieldValue(Object targetObj, String fieldName, Object value) thr
 					cArg[0] = String.class;
 					Object fieldInstance = PrivateUtilities.getFieldValue(targetObj, fieldName);
 					Method mth;
-					if (value instanceof IJsonFormattable)
+					if (value instanceof JSONArray || value instanceof JSONObjectWrapper)
 					{
-						mth = field.getType().getMethod("FromJSONObject", new Class[]{IJsonFormattable.class});
+						mth = field.getType().getMethod("FromJSONObject", new Class[]{Object.class});
 						mth.invoke(fieldInstance , new Object[]{value});
 					}
 					else
@@ -877,7 +877,7 @@ private Object[] beforeInvoke() throws JSONException, Exception {
 				int len = dynAjaxEventContext.inParmsMetadata.length();
 				boolean multipart = targetObj.httpContext.isMultipartContent();
 				for (int i = 0; i < len; i++) {
-					JSONObject parm = (JSONObject) dynAjaxEventContext.inParmsMetadata.getJSONObject(i);
+					JSONObjectWrapper parm = (JSONObjectWrapper) dynAjaxEventContext.inParmsMetadata.getJSONObject(i);
 					try{
 						if (parm.has("postForm"))
 						{
@@ -914,7 +914,7 @@ private Object[] beforeInvoke() throws JSONException, Exception {
 									//Case for each line command or collection based grid
 									int colDataLen = (allCollData == null) ? 0 : allCollData.length();
 									for (int k = 0; k < colDataLen; k++) {
-										JSONObject columnData = (JSONObject)allCollData.get(k);
+										JSONObjectWrapper columnData = (JSONObjectWrapper)allCollData.get(k);
 										parentRow = (String)columnData.get("pRow");
 										columnValues = (JSONArray)columnData.get("c");
 										if (columnData.has("hsh")) {
@@ -1012,7 +1012,7 @@ private Object[] beforeInvoke() throws JSONException, Exception {
 									columnValues = (value instanceof JSONArray ? (JSONArray)value : null);
 									if (parm.has("hsh") && httpContext.useSecurityTokenValidation()) {
 										try {
-											JSONObject hashObj = (JSONObject)((hash_i < inHashValues.length()) ? inHashValues.get(hash_i) : new JSONObject());
+											JSONObjectWrapper hashObj = (JSONObjectWrapper)((hash_i < inHashValues.length()) ? inHashValues.get(hash_i) : new JSONObjectWrapper());
 											String sRow = "";
 											String hash = "";
 											try {
@@ -1192,7 +1192,7 @@ protected void callWebObject(String url)
 		{
 			try
 			{
-				JSONObject jsonCmd = new JSONObject();
+				JSONObjectWrapper jsonCmd = new JSONObjectWrapper();
 				jsonCmd.put("url", url);
 				jsonCmd.put("target", target);
 				httpContext.appendAjaxCommand("calltarget", jsonCmd);
diff --git a/gxweb/src/main/java/com/genexus/webpanels/GXWebRow.java b/gxweb/src/main/java/com/genexus/webpanels/GXWebRow.java
index a53e39974..08ccc4942 100644
--- a/gxweb/src/main/java/com/genexus/webpanels/GXWebRow.java
+++ b/gxweb/src/main/java/com/genexus/webpanels/GXWebRow.java
@@ -9,32 +9,31 @@
 import com.genexus.internet.IGxJSONAble;
 import com.genexus.common.interfaces.IGXWebRow;
 
-import json.org.json.IJsonFormattable;
-import json.org.json.JSONArray;
-import json.org.json.JSONException;
-import json.org.json.JSONObject;
+import org.json.JSONArray;
+import org.json.JSONException;
+import com.genexus.json.JSONObjectWrapper;
 
 
 public class GXWebRow implements IGxJSONAble, IGXWebRow
 {
     ModelContext context;
     GXWebGrid _parentGrid;
-    JSONObject _ThisRow;
+	JSONObjectWrapper _ThisRow;
     JSONArray _Columns;
     JSONArray _RenderProps;
-    JSONObject _Hiddens;
-    JSONObject _Grids;
+	JSONObjectWrapper _Hiddens;
+	JSONObjectWrapper _Grids;
     int _Count;
     JSONArray _Values;
     boolean firstRowAdded;
 
     public GXWebRow()
     {
-        _ThisRow = new JSONObject();
+        _ThisRow = new JSONObjectWrapper();
         _Columns = new JSONArray();
         _RenderProps = new JSONArray();
-        _Hiddens = new JSONObject();
-        _Grids = new JSONObject();
+        _Hiddens = new JSONObjectWrapper();
+        _Grids = new JSONObjectWrapper();
         _Values = new JSONArray();
         _Count = 0;
     }
@@ -130,7 +129,7 @@ public void AddColumnProperties(int valueIndex, boolean valueWithProps, Object[]
                     {
                         equal = false;
                         try{
-                        	colProps.putIndex(0, prop);
+							colProps.put(0, prop);
                         }catch (JSONException e){}
                         if (it == null)
                             colPropsRev.put(prop);
@@ -249,7 +248,7 @@ public Object GetJSONObject()
         return _ThisRow;
     }
 
-    public void FromJSONObject(IJsonFormattable obj)
+    public void FromJSONObject(Object obj)
     {
     }
 }
diff --git a/gxweb/src/main/java/com/genexus/webpanels/GXWindow.java b/gxweb/src/main/java/com/genexus/webpanels/GXWindow.java
index b65002a07..2dd6e477e 100644
--- a/gxweb/src/main/java/com/genexus/webpanels/GXWindow.java
+++ b/gxweb/src/main/java/com/genexus/webpanels/GXWindow.java
@@ -4,8 +4,7 @@
 import com.genexus.internet.IGxJSONAble;
 import com.genexus.common.interfaces.IGXWindow;
 
-import json.org.json.IJsonFormattable;
-import json.org.json.JSONArray;
+import org.json.JSONArray;
 
 public class GXWindow implements IGxJSONAble, IGXWindow
 {
@@ -152,7 +151,7 @@ public Object GetJSONObject()
         return jArr;
     }
 
-    public void FromJSONObject(IJsonFormattable obj)
+    public void FromJSONObject(Object obj)
     {
     }
 
diff --git a/gxweb/src/main/java/com/genexus/webpanels/HTMLChoice.java b/gxweb/src/main/java/com/genexus/webpanels/HTMLChoice.java
index 1ae39318b..3fa09b80d 100644
--- a/gxweb/src/main/java/com/genexus/webpanels/HTMLChoice.java
+++ b/gxweb/src/main/java/com/genexus/webpanels/HTMLChoice.java
@@ -6,10 +6,9 @@
 import com.genexus.CommonUtil;
 import com.genexus.GXutil;
 
-import json.org.json.IJsonFormattable;
-import json.org.json.JSONArray;
-import json.org.json.JSONException;
-import json.org.json.JSONObject;
+import org.json.JSONArray;
+import org.json.JSONException;
+import com.genexus.json.JSONObjectWrapper;
 
 public class HTMLChoice extends HTMLObject implements IChoice
 {
@@ -143,7 +142,7 @@ public void removeAllItems()
 	{
 		_IsSet = true;
 		listval.removeAllElements();
-		jsonObj = new JSONObject();
+		jsonObj = new JSONObjectWrapper();
 	}
 
 	public void removeItem(String key)
@@ -287,10 +286,10 @@ public void tojson()
                 }
 	}
 
-        public void FromJSONObject(IJsonFormattable obj)
+        public void FromJSONObject(Object obj)
 	{
             this.removeAllItems();
-            jsonObj = (JSONObject)obj;
+            jsonObj = (JSONObjectWrapper)obj;
             try
             {
                 JSONArray jsonArrValues = (JSONArray)jsonObj.get("v");
diff --git a/gxweb/src/main/java/com/genexus/webpanels/HTMLObject.java b/gxweb/src/main/java/com/genexus/webpanels/HTMLObject.java
index cabf7eb73..2c9082b75 100644
--- a/gxweb/src/main/java/com/genexus/webpanels/HTMLObject.java
+++ b/gxweb/src/main/java/com/genexus/webpanels/HTMLObject.java
@@ -6,9 +6,8 @@
 import com.genexus.internet.IGxJSONAble;
 import com.genexus.internet.IGxJSONSerializable;
 
-import json.org.json.IJsonFormattable;
-import json.org.json.JSONException;
-import json.org.json.JSONObject;
+import org.json.JSONException;
+import com.genexus.json.JSONObjectWrapper;
 
 public class HTMLObject implements IGxJSONAble, IGxJSONSerializable
 {
@@ -41,7 +40,7 @@ public class HTMLObject implements IGxJSONAble, IGxJSONSerializable
 	protected String themeClass = "";
 	protected String columnClass = "";
 	protected String columnHeaderClass = "";
-	protected JSONObject jsonObj = new JSONObject();
+	protected JSONObjectWrapper jsonObj = new JSONObjectWrapper();
 	
 	public HTMLObject(GXWebPanel panel)
 	{
@@ -541,7 +540,7 @@ public Object GetJSONObject()
 		return jsonObj;
 	}
 
-	public void FromJSONObject(IJsonFormattable obj)
+	public void FromJSONObject(Object obj)
 	{
 	}
 
@@ -557,7 +556,7 @@ public boolean fromJSonString(String s, GXBaseCollection<SdtMessages_Message> me
 	{
 		try
 		{
-			jsonObj = new JSONObject(s);
+			jsonObj = new JSONObjectWrapper(s);
 			FromJSONObject(jsonObj);
 			return true;
 		}
diff --git a/java/src/main/java/com/genexus/GXutil.java b/java/src/main/java/com/genexus/GXutil.java
index d141ccde4..9efab841e 100644
--- a/java/src/main/java/com/genexus/GXutil.java
+++ b/java/src/main/java/com/genexus/GXutil.java
@@ -15,7 +15,7 @@
 import com.genexus.platform.NativeFunctions;
 import com.genexus.util.*;
 
-import json.org.json.JSONObject;
+import org.json.JSONObject;
 import org.apache.commons.lang.StringUtils;
 
 public final class GXutil
diff --git a/java/src/main/java/com/genexus/GxRestService.java b/java/src/main/java/com/genexus/GxRestService.java
index cfd2b6f62..72d1ff71a 100644
--- a/java/src/main/java/com/genexus/GxRestService.java
+++ b/java/src/main/java/com/genexus/GxRestService.java
@@ -13,13 +13,13 @@
 import com.genexus.servlet.http.IHttpServletResponse;
 import com.genexus.webpanels.HttpContextWeb;
 
-import json.org.json.JSONException;
-import json.org.json.JSONObject;
+import org.json.JSONException;
+import com.genexus.json.JSONObjectWrapper;
 
 abstract public class GxRestService extends GXObjectBase {
 	private static ILogger logger = null;
 	
-	protected JSONObject errorJson;
+	protected JSONObjectWrapper errorJson;
 	protected boolean error = false;
 	protected String gamError;
 	protected boolean forbidden = false;
@@ -116,10 +116,10 @@ public void SetError(String code, String message)
 	{
 		try
 		{
-			JSONObject obj = new JSONObject();
+			JSONObjectWrapper obj = new JSONObjectWrapper();
 			obj.put("code", code);
 			obj.put("message", message);
-			errorJson = new JSONObject();
+			errorJson = new JSONObjectWrapper();
 			errorJson.put("error", obj);
 		}
 		catch(JSONException e)
diff --git a/java/src/main/java/com/genexus/GxUserType.java b/java/src/main/java/com/genexus/GxUserType.java
index a54218871..b3be376b8 100644
--- a/java/src/main/java/com/genexus/GxUserType.java
+++ b/java/src/main/java/com/genexus/GxUserType.java
@@ -2,7 +2,7 @@
 
 import com.genexus.xml.GXXMLSerializable;
 import java.util.HashMap;
-import json.org.json.JSONObject;
+import com.genexus.json.JSONObjectWrapper;
 import org.apache.logging.log4j.Logger;
 
 public abstract class GxUserType extends GXXMLSerializable implements Cloneable, java.io.Serializable, IGXAssigned
@@ -34,10 +34,10 @@ public void setIsAssigned(boolean bAssigned) {
 	}
 
 	protected Object getJsonObjectFromHashMap( Object userType) {
-		JSONObject jsonObj = new JSONObject();
+		JSONObjectWrapper jsonObj = new JSONObjectWrapper();
 		try {
 			if (userType instanceof HashMap)
-				jsonObj = new json.org.json.JSONObject((HashMap)userType);
+				jsonObj = new JSONObjectWrapper((HashMap)userType);
 		}
 		catch(Exception e) {
 			log.error("Could not create Json Object", e);
diff --git a/java/src/main/java/com/genexus/filters/APIObjectFilter.java b/java/src/main/java/com/genexus/filters/APIObjectFilter.java
index 249e14898..f3b5b43cf 100644
--- a/java/src/main/java/com/genexus/filters/APIObjectFilter.java
+++ b/java/src/main/java/com/genexus/filters/APIObjectFilter.java
@@ -1,6 +1,6 @@
 package com.genexus.filters;
 
-import json.org.json.*;
+import com.genexus.json.JSONObjectWrapper;
 import java.io.IOException;
 import java.io.File;
 import java.util.Map;
@@ -79,7 +79,7 @@ public void init(Map<String, String> headers, String path, String sessionCookieN
             		for (String temp : result) {
 						try {
 							String read = String.join("", Files.readAllLines(Paths.get(temp)));
-							JSONObject jo = new JSONObject(read);
+							JSONObjectWrapper jo = new JSONObjectWrapper(read);
 							String apiPath = jo.getString("BasePath");
 							appPath.add(apiPath.toLowerCase());
 						}
diff --git a/java/src/main/java/com/genexus/internet/GXRestAPIClient.java b/java/src/main/java/com/genexus/internet/GXRestAPIClient.java
index ea0f7a748..ef548eb48 100644
--- a/java/src/main/java/com/genexus/internet/GXRestAPIClient.java
+++ b/java/src/main/java/com/genexus/internet/GXRestAPIClient.java
@@ -1,15 +1,14 @@
 package com.genexus.internet;
 
 import java.util.*;
-import json.org.json.JSONException;
-import json.org.json.JSONObject;
+import org.json.JSONException;
+import org.json.JSONObject;
 
 import java.text.SimpleDateFormat;
 import java.math.BigDecimal;
 import java.text.ParseException;
 
-import json.org.json.IJsonFormattable;
-import json.org.json.JSONArray;
+import org.json.JSONArray;
 import com.genexus.internet.IGxJSONAble;
 import com.genexus.xml.GXXMLSerializable;
 import com.genexus.internet.IGxJSONSerializable;
@@ -392,7 +391,7 @@ else if (jsonResponse.length()>= 1) {
 				return null;
 			}
 		} 
-		catch (json.org.json.JSONException e) {
+		catch (JSONException e) {
 			errorCode = PARSING_ERROR_CODE;
 			errorMessage = PARSING_ERROR_MSG;
 			logError(PARSING_ERROR_CODE, PARSING_ERROR_MSG + " " + sdtClass, e);
@@ -422,7 +421,7 @@ else if (jsonResponse.length() == 1 && jsonResponse.has(""))
 
 			if (jsonarr != null) {
 				for (int i=0; i < jsonarr.length(); i++) {
-    				JSONObject o = jsonarr.getJSONObject(i);
+					JSONObject o = jsonarr.getJSONObject(i);
 					T sdt = elementClass.newInstance();
 					sdt.fromJSonString(o.toString(),null);
 					col.add(sdt);
@@ -434,7 +433,7 @@ else if (jsonResponse.length() == 1 && jsonResponse.has(""))
 				logError(RESPONSE_ERROR_CODE,RESPONSE_ERROR_MSG + " " + elementClass);
 			}	
 		} 
-		catch (json.org.json.JSONException e) {
+		catch (JSONException e) {
 			errorCode = PARSING_ERROR_CODE;
 			errorMessage = PARSING_ERROR_MSG;
 			logError(PARSING_ERROR_CODE,PARSING_ERROR_MSG + " " + elementClass ,e );
@@ -462,7 +461,7 @@ else if (jsonResponse.length() == 1 && jsonResponse.has("")) {
 				coll.fromJSonString(jsonResponse.getString(varName), null);
 			} 
 		} 
-		catch (json.org.json.JSONException e) {
+		catch (JSONException e) {
 			errorCode = PARSING_ERROR_CODE;
 			errorMessage = PARSING_ERROR_MSG;
 			logError(PARSING_ERROR_CODE,PARSING_ERROR_MSG + " " + elementClasss, e);
diff --git a/java/src/main/java/com/genexus/internet/HttpContext.java b/java/src/main/java/com/genexus/internet/HttpContext.java
index f7bf07879..1e3979d66 100644
--- a/java/src/main/java/com/genexus/internet/HttpContext.java
+++ b/java/src/main/java/com/genexus/internet/HttpContext.java
@@ -5,10 +5,9 @@
 import com.genexus.servlet.http.IHttpServletRequest;
 import com.genexus.servlet.http.IHttpServletResponse;
 import com.genexus.webpanels.WebSession;
-import json.org.json.IJsonFormattable;
-import json.org.json.JSONArray;
-import json.org.json.JSONException;
-import json.org.json.JSONObject;
+import org.json.JSONArray;
+import org.json.JSONException;
+import com.genexus.json.JSONObjectWrapper;
 import org.apache.logging.log4j.Logger;
 
 import java.io.IOException;
@@ -247,7 +246,7 @@ protected void copyCommon(HttpContext ctx)
 	public abstract String cgiGet(String parm);
     public abstract void changePostValue(String ctrl, String value);
 	public abstract boolean isFileParm( String parm);
-    public abstract void parseGXState(JSONObject tokenValues);
+    public abstract void parseGXState(JSONObjectWrapper tokenValues);
 	public abstract void deletePostValue(String ctrl);
 	public abstract void DeletePostValuePrefix(String sPrefix);
 	public abstract HttpResponse getHttpResponse();
@@ -960,11 +959,11 @@ public void readJsonSdtValue(String jsonStr, Object SdtObj)
 	{
 		try
 		{
-			IJsonFormattable jsonObj;
+			Object jsonObj;
 			if (jsonStr.startsWith("["))
 				jsonObj = new JSONArray(jsonStr);
 			else
-				jsonObj = new JSONObject(jsonStr);
+				jsonObj = new JSONObjectWrapper(jsonStr);
 			((IGxJSONAble)SdtObj).FromJSONObject(jsonObj);
 		}
 		catch(JSONException exc) {}
diff --git a/java/src/main/java/com/genexus/internet/HttpContextNull.java b/java/src/main/java/com/genexus/internet/HttpContextNull.java
index 4e3b2ed01..832e13373 100644
--- a/java/src/main/java/com/genexus/internet/HttpContextNull.java
+++ b/java/src/main/java/com/genexus/internet/HttpContextNull.java
@@ -13,7 +13,7 @@
 import com.genexus.db.DBConnectionManager;
 import com.genexus.webpanels.WebSession;
 
-import json.org.json.JSONObject;
+import com.genexus.json.JSONObjectWrapper;
 
 public class HttpContextNull extends HttpContext implements IHttpContextNull
 {
@@ -361,7 +361,7 @@ public void deletePostValue(String ctrl)
 	public void DeletePostValuePrefix(String sPrefix)
 	{
 	}
-    public void parseGXState(JSONObject tokenValues)
+    public void parseGXState(JSONObjectWrapper tokenValues)
     {
     }
 	public boolean isFileParm( String parm)
diff --git a/java/src/main/java/com/genexus/internet/websocket/GXWebSocketService.java b/java/src/main/java/com/genexus/internet/websocket/GXWebSocketService.java
index 758d04b17..f626458e0 100644
--- a/java/src/main/java/com/genexus/internet/websocket/GXWebSocketService.java
+++ b/java/src/main/java/com/genexus/internet/websocket/GXWebSocketService.java
@@ -9,8 +9,8 @@
 import com.genexus.db.UserInformation;
 import com.genexus.diagnostics.core.ILogger;
 import com.genexus.diagnostics.core.LogManager;
-import json.org.json.JSONException;
-import json.org.json.JSONObject;
+import org.json.JSONException;
+import com.genexus.json.JSONObjectWrapper;
 
 import com.genexus.Application;
 import com.genexus.GXutil;
@@ -72,7 +72,7 @@ protected void onMessage(String txt, ISession session) {
 		try {
 
 			GXXMLSerializable nInfo = (GXXMLSerializable) Class.forName("com.genexuscore.genexus.server.SdtNotificationInfo").getConstructor().newInstance();
-			JSONObject jInfo = new JSONObject();
+			JSONObjectWrapper jInfo = new JSONObjectWrapper();
 			jInfo.put("Message", txt);
 			nInfo.FromJSONObject(jInfo);
 			parameters[1] = nInfo;
diff --git a/java/src/main/java/com/genexus/sap/EnterpriseConnect.java b/java/src/main/java/com/genexus/sap/EnterpriseConnect.java
index 898954951..a5d28da25 100644
--- a/java/src/main/java/com/genexus/sap/EnterpriseConnect.java
+++ b/java/src/main/java/com/genexus/sap/EnterpriseConnect.java
@@ -20,9 +20,9 @@
 import com.sap.conn.jco.JCoStructure;
 import com.sap.conn.jco.JCoTable;
 
-import json.org.json.JSONArray;
-import json.org.json.JSONException;
-import json.org.json.JSONObject;
+import org.json.JSONArray;
+import org.json.JSONException;
+import com.genexus.json.JSONObjectWrapper;
 
 public class EnterpriseConnect
 {
@@ -136,7 +136,7 @@ public void setValue(String parameterName, GXSimpleCollection<?> value, Boolean
 				if (item != null)
 				{
 					setValues = true;
-					JSONObject jObj = (JSONObject ) item.GetJSONObject();
+					JSONObjectWrapper jObj = (JSONObjectWrapper ) item.GetJSONObject();
 					jTable.appendRow();
 					jTable.lastRow();
 					Iterator<?> keys = jObj.keys();
@@ -205,7 +205,7 @@ public void setValue(String parameterName, IGxJSONAble value)
 			JCoStructure jStruct = function.getImportParameterList().getStructure(parameterName);	
 			if (value != null)
 			{
-				JSONObject jObj = (JSONObject ) value.GetJSONObject();		
+				JSONObjectWrapper jObj = (JSONObjectWrapper ) value.GetJSONObject();
 				Iterator<?> keys = jObj.keys();
 				while( keys.hasNext() )
 				{
@@ -265,8 +265,8 @@ public void getValue(String parameterName, GXSimpleCollection<?>[] value)
 			try
 			{
 				for(int i = 0; i <  tbl.getNumRows(); i++)
-				{					
-					JSONObject jRow = new JSONObject();
+				{
+					JSONObjectWrapper jRow = new JSONObjectWrapper();
 					tbl.setRow(i);
 					for(JCoField field : tbl)
 					{
@@ -307,8 +307,8 @@ public void getValue(String parameterName, IGxJSONAble[] value)
 		try
 		{
 			IGxJSONAble struct = value[0];
-			JCoStructure jStruct = function.getExportParameterList().getStructure(parameterName);				
-			JSONObject jRow = new JSONObject();
+			JCoStructure jStruct = function.getExportParameterList().getStructure(parameterName);
+			JSONObjectWrapper jRow = new JSONObjectWrapper();
 			for(JCoField field : jStruct)
 			{
 			   if ( field.getType() == JCoMetaData.TYPE_NUM || 
diff --git a/java/src/main/java/com/genexus/specific/java/Connect.java b/java/src/main/java/com/genexus/specific/java/Connect.java
index 514024fce..0d3641250 100644
--- a/java/src/main/java/com/genexus/specific/java/Connect.java
+++ b/java/src/main/java/com/genexus/specific/java/Connect.java
@@ -4,13 +4,8 @@
 
 import com.genexus.ApplicationContext;
 import com.genexus.common.interfaces.SpecificImplementation;
-import com.genexus.db.UserInformation;
-
-import json.org.json.IExtensionJSONObject;
-import json.org.json.JSONException;
-import json.org.json.JSONObject;
-
 
+import org.json.JSONException;
 
 public final class Connect {
 
@@ -47,27 +42,5 @@ public static void init()
 		SpecificImplementation.cdowMask = "EEEEE";
 		SpecificImplementation.SupportPending = false;
 		SpecificImplementation.UseUnicodeCharacterClass = true;
-		JSONObject.extension = new JSONObjectExtension();
-		}
-		
-		 static class JSONObjectExtension implements IExtensionJSONObject {
-
-			@Override
-			public String dateToString(Date d) throws JSONException {
-				if (d == null) {
-			        throw new JSONException("Null pointer");
-			    }
-			    UserInformation ui = (UserInformation) com.genexus.GXObjectHelper.getUserInformation(new com.genexus.ModelContext(com.genexus.ModelContext.getModelContextPackageClass()), -1);
-			    com.genexus.LocalUtil localUtil = ui.getLocalUtil();
-			    String dateString = localUtil.format(d, localUtil.getDateFormat() + " " + localUtil.getTimeFormat());
-			    try
-			    {
-			    	com.genexus.db.DBConnectionManager.getInstance().disconnect(ui.getHandle());
-			    }
-			    catch (Throwable e)
-			    {}
-			    return dateString;
-			}
-			
 		}
 }
diff --git a/java/src/main/java/com/genexus/specific/java/GXutil.java b/java/src/main/java/com/genexus/specific/java/GXutil.java
index 9eaab4adf..7ae57578b 100644
--- a/java/src/main/java/com/genexus/specific/java/GXutil.java
+++ b/java/src/main/java/com/genexus/specific/java/GXutil.java
@@ -13,8 +13,8 @@
 
 import com.genexus.CommonUtil;
 import com.genexus.ModelContext;
-import json.org.json.JSONException;
-import json.org.json.JSONObject;
+import org.json.JSONException;
+import com.genexus.json.JSONObjectWrapper;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.IOUtils;
 
@@ -202,7 +202,7 @@ public String getUploadValue(String value, String fieldName) {
 		if (com.genexus.CommonUtil.isUploadPrefix(value) && CacheAPI.files().contains(uploadId)) {
 			String uploadValueJson = CacheAPI.files().get(uploadId);
 			try {
-				JSONObject json = new JSONObject(uploadValueJson);
+				JSONObjectWrapper json = new JSONObjectWrapper(uploadValueJson);
 				value = (String)json.get(fieldName);
 			}
 			catch (JSONException e) {
diff --git a/java/src/main/java/com/genexus/webpanels/GXMultiCall.java b/java/src/main/java/com/genexus/webpanels/GXMultiCall.java
index e7c1dc85b..59fdcf51d 100644
--- a/java/src/main/java/com/genexus/webpanels/GXMultiCall.java
+++ b/java/src/main/java/com/genexus/webpanels/GXMultiCall.java
@@ -10,7 +10,7 @@
 import com.genexus.db.UserInformation;
 import com.genexus.ws.rs.core.Response;
 
-import json.org.json.JSONArray;
+import org.json.JSONArray;
 
 @javax.ws.rs.Path("/gxmulticall")
 @jakarta.ws.rs.Path("/gxmulticall")
diff --git a/java/src/main/java/com/genexus/webpanels/GXOAuthAccessToken.java b/java/src/main/java/com/genexus/webpanels/GXOAuthAccessToken.java
index f564e1534..baac61600 100644
--- a/java/src/main/java/com/genexus/webpanels/GXOAuthAccessToken.java
+++ b/java/src/main/java/com/genexus/webpanels/GXOAuthAccessToken.java
@@ -8,8 +8,8 @@
 import com.genexus.security.GXSecurityProvider;
 import com.genexus.security.OutData;
 
-import json.org.json.JSONException;
-import json.org.json.JSONObject;
+import org.json.JSONException;
+import com.genexus.json.JSONObjectWrapper;
 
 public class GXOAuthAccessToken extends GXWebObjectStub
 {   
@@ -127,7 +127,7 @@ protected void doExecute(HttpContext context) throws Exception
 					}
 					String OauthRealm = "OAuth realm=\"" + context.getRequest().getServerName() + "\"" + ",error_code=\"" + gamError + "\"" + ",error_description=\"" + messagePermissionEncoded + "\"";
 					context.getResponse().addHeader("WWW-Authenticate", OauthRealm);
-					JSONObject err = getError(gamError, messagePermission);
+					JSONObjectWrapper err = getError(gamError, messagePermission);
 					((HttpContextWeb) context).writeText(err.toString());
 					context.getResponse().flushBuffer();
 					return;
@@ -141,8 +141,8 @@ protected void doExecute(HttpContext context) throws Exception
 							context.getResponse().setStatus(200);
 						else
 							context.getResponse().setStatus(303);
-						context.getResponse().addHeader("location", redirectURL[0]); 
-						JSONObject jObj = new JSONObject();
+						context.getResponse().addHeader("location", redirectURL[0]);
+						JSONObjectWrapper jObj = new JSONObjectWrapper();
 						jObj.put("Location", redirectURL[0]);
 						((HttpContextWeb) context).writeText(jObj.toString());
 						context.getResponse().flushBuffer();
@@ -165,14 +165,14 @@ protected void doExecute(HttpContext context) throws Exception
 			}
    	}
 
-    private JSONObject getError(String code, String message)
+    private JSONObjectWrapper getError(String code, String message)
 		{
 			try
 			{
-				JSONObject obj = new JSONObject();
+				JSONObjectWrapper obj = new JSONObjectWrapper();
 				obj.put("code", code);
 				obj.put("message", message);
-				JSONObject errorJson = new JSONObject();
+				JSONObjectWrapper errorJson = new JSONObjectWrapper();
 				errorJson.put("error", obj);
 				return errorJson;
 			}
diff --git a/java/src/main/java/com/genexus/webpanels/GXOAuthLogout.java b/java/src/main/java/com/genexus/webpanels/GXOAuthLogout.java
index bbe1b5530..bd18079d2 100644
--- a/java/src/main/java/com/genexus/webpanels/GXOAuthLogout.java
+++ b/java/src/main/java/com/genexus/webpanels/GXOAuthLogout.java
@@ -4,7 +4,7 @@
 import com.genexus.ModelContext;
 import com.genexus.internet.HttpContext;
 import com.genexus.security.GXSecurityProvider;
-import json.org.json.JSONObject;
+import com.genexus.json.JSONObjectWrapper;
 
 public class GXOAuthLogout extends GXWebObjectStub
 {   
@@ -30,7 +30,7 @@ protected void doExecute(HttpContext context) throws Exception
 				context.getResponse().setStatus(statusCode[0]);
 
 			context.getResponse().setContentType("application/json");
-			JSONObject jObj = new JSONObject();
+			JSONObjectWrapper jObj = new JSONObjectWrapper();
 			if (genexus_agent.equals("WebFrontend Application") && URL[0].length() > 0)
 			{				
 				context.getResponse().addHeader("GXLocation", URL[0]);			
diff --git a/java/src/main/java/com/genexus/webpanels/GXObjectUploadServices.java b/java/src/main/java/com/genexus/webpanels/GXObjectUploadServices.java
index 0f1c42adb..c71a340eb 100644
--- a/java/src/main/java/com/genexus/webpanels/GXObjectUploadServices.java
+++ b/java/src/main/java/com/genexus/webpanels/GXObjectUploadServices.java
@@ -4,8 +4,8 @@
 import com.genexus.*;
 import com.genexus.internet.HttpContext;
 
-import json.org.json.JSONArray;
-import json.org.json.JSONObject;
+import org.json.JSONArray;
+import com.genexus.json.JSONObjectWrapper;
 import org.apache.commons.io.FilenameUtils;
 
 import java.io.InputStream;
@@ -63,7 +63,7 @@ protected void doExecute(HttpContext context) throws Exception
 						fileName = CommonUtil.getFileName(file.getName()) + "." + ext;
 						long fileSize = file.getSize();
 						savedFileName = file.getPath();
-						JSONObject jObj = new JSONObject();
+						JSONObjectWrapper jObj = new JSONObjectWrapper();
 						jObj.put("name", fileName);
 						jObj.put("size", fileSize);
 						jObj.put("extension", ext);
@@ -74,7 +74,7 @@ protected void doExecute(HttpContext context) throws Exception
 						}
 					}
 				}
-				JSONObject jObjResponse = new JSONObject();
+				JSONObjectWrapper jObjResponse = new JSONObjectWrapper();
 				jObjResponse.put("files", jsonArray);
 				((HttpContextWeb) context).writeText(jObjResponse.toString());
 				context.getResponse().flushBuffer();
@@ -98,7 +98,7 @@ protected void doExecute(HttpContext context) throws Exception
 				try (InputStream is = context.getRequest().getInputStream().getInputStream()) {
 					FileItem fileItem = new FileItem(filePath, false, "", is);
 					savedFileName = fileItem.getPath();
-					JSONObject jObj = new JSONObject();
+					JSONObjectWrapper jObj = new JSONObjectWrapper();
 					jObj.put("object_id", HttpUtils.getUploadFileId(keyId));
 					if (!isRestCall) {
 						context.getResponse().setContentType("application/json");
diff --git a/java/src/main/java/com/genexus/webpanels/HttpContextWeb.java b/java/src/main/java/com/genexus/webpanels/HttpContextWeb.java
index d54081c8c..84cbc0eba 100644
--- a/java/src/main/java/com/genexus/webpanels/HttpContextWeb.java
+++ b/java/src/main/java/com/genexus/webpanels/HttpContextWeb.java
@@ -34,8 +34,8 @@
 import com.genexus.util.Base64;
 import com.genexus.util.GXFile;
 
-import json.org.json.JSONException;
-import json.org.json.JSONObject;
+import org.json.JSONException;
+import com.genexus.json.JSONObjectWrapper;
 
 public class HttpContextWeb extends HttpContext {
 	private static Logger log = org.apache.logging.log4j.LogManager.getLogger(HttpContextWeb.class);
@@ -351,7 +351,7 @@ private boolean tryLoadAjaxCallParms() {
 		return false;
 	}
 
-	public void parseGXState(JSONObject tokenValues) {
+	public void parseGXState(JSONObjectWrapper tokenValues) {
 		try {
 			Iterator it = tokenValues.keys();
 			while (it.hasNext()) {
@@ -390,14 +390,14 @@ public Hashtable<String, String[]> getPostData() {
 						if (useBase64ViewState()) {
 							decoded = new String(Base64.decode(decoded), "UTF8");
 						}
-						JSONObject tokenValues = null;
+						JSONObjectWrapper tokenValues = null;
 						try {
-							tokenValues = new JSONObject(decoded);
+							tokenValues = new JSONObjectWrapper(decoded);
 						} catch (JSONException jex) {
 							log.debug("GXState JSONObject error (1)", jex);
 							char c = 0;
 							decoded = decoded.replace(Character.toString(c), "");
-							tokenValues = new JSONObject(decoded);
+							tokenValues = new JSONObjectWrapper(decoded);
 						}
 						parseGXState(tokenValues);
 					} catch (Exception ex) {
diff --git a/java/src/main/java/com/genexus/webpanels/HttpUtils.java b/java/src/main/java/com/genexus/webpanels/HttpUtils.java
index 0ed2e3729..e78f2016d 100644
--- a/java/src/main/java/com/genexus/webpanels/HttpUtils.java
+++ b/java/src/main/java/com/genexus/webpanels/HttpUtils.java
@@ -2,8 +2,8 @@
 import com.genexus.CommonUtil;
 import com.genexus.internet.HttpContext;
 import com.genexus.util.CacheAPI;
-import json.org.json.JSONException;
-import json.org.json.JSONObject;
+import org.json.JSONException;
+import com.genexus.json.JSONObjectWrapper;
 import org.apache.commons.io.IOUtils;
 import org.apache.logging.log4j.Logger;
 
@@ -261,7 +261,7 @@ public static String getUploadFileId(String keyId) {
 
 	public static void CacheUploadFile(String keyId, String uploadFilePath, String fileName, String fileExtension) {
 		try {
-			JSONObject jObj = new JSONObject();
+			JSONObjectWrapper jObj = new JSONObjectWrapper();
 			jObj.put("path", uploadFilePath);
 			jObj.put("fileName", fileName);
 			jObj.put("fileExtension", fileExtension);
diff --git a/wrappercommon/src/main/java/com/genexus/WrapperUtils.java b/wrappercommon/src/main/java/com/genexus/WrapperUtils.java
index caf94347f..05173db5a 100644
--- a/wrappercommon/src/main/java/com/genexus/WrapperUtils.java
+++ b/wrappercommon/src/main/java/com/genexus/WrapperUtils.java
@@ -7,8 +7,8 @@
 import java.util.stream.Collectors;
 
 import com.genexus.opentelemetry.OpenTelemetryHelper;
-import json.org.json.JSONException;
-import json.org.json.JSONObject;
+import org.json.JSONException;
+import com.genexus.json.JSONObjectWrapper;
 import org.apache.commons.io.IOUtils;
 import org.apache.logging.log4j.Logger;
 
@@ -31,10 +31,10 @@ public static String getJsonFromRestException(int[] statusCode, String reasonPhr
         }
 
         log.error("Error executing REST service", ex);
-        JSONObject errorJson = new JSONObject();
+		JSONObjectWrapper errorJson = new JSONObjectWrapper();
         try
         {
-            JSONObject obj = new JSONObject();
+			JSONObjectWrapper obj = new JSONObjectWrapper();
             obj.put("code", localStatusCode);
             obj.put("message", reasonPhrase);
             errorJson.put("error", obj);

From 3b607cee9038f14adc6f76ec4ef1e9df2bbc1830 Mon Sep 17 00:00:00 2001
From: iroqueta <iroqueta@genexus.com>
Date: Wed, 22 May 2024 16:55:02 -0300
Subject: [PATCH 02/24] Remove org.json lib fork and use new version of the API
 https://github.com/stleary/JSON-java Issue: 105607

---
 .../com/genexus/json/JSONObjectWrapper.java   | 72 +++++++++++++++++++
 1 file changed, 72 insertions(+)
 create mode 100644 common/src/main/java/com/genexus/json/JSONObjectWrapper.java

diff --git a/common/src/main/java/com/genexus/json/JSONObjectWrapper.java b/common/src/main/java/com/genexus/json/JSONObjectWrapper.java
new file mode 100644
index 000000000..d08435587
--- /dev/null
+++ b/common/src/main/java/com/genexus/json/JSONObjectWrapper.java
@@ -0,0 +1,72 @@
+package com.genexus.json;
+
+import java.util.*;
+
+import java.util.Map.Entry;
+import org.json.JSONException;
+import org.json.JSONObject;
+public class JSONObjectWrapper extends JSONObject{
+	private Map<String, Object> map;
+
+	public JSONObjectWrapper() {
+		super();
+		if (map == null)
+			map = new LinkedHashMap<String, Object>();
+	}
+
+	public JSONObjectWrapper(String string) {
+		super(string);
+		if (map == null)
+			map = new LinkedHashMap<String, Object>();
+	}
+
+	public JSONObjectWrapper(Map<?,?> m) {
+		super(m);
+		if (map == null)
+			map = new LinkedHashMap<String, Object>();
+		else {
+			map = new LinkedHashMap<String, Object>(m.size());
+			for (final Entry<?, ?> e : m.entrySet()) {
+				if (e.getKey() == null) {
+					throw new NullPointerException("Null key.");
+				}
+				final Object value = e.getValue();
+				if (value != null)
+					this.map.put(String.valueOf(e.getKey()), value);
+			}
+		}
+	}
+
+	public JSONObjectWrapper(JSONObject jsonObject) {
+		super(jsonObject.toString());
+		if (map == null)
+			map = new LinkedHashMap<String, Object>();
+	}
+
+	public Set<Entry<String, Object>> entrySet() {
+		return map.entrySet();
+	}
+
+	public void clear() {
+		super.clear();
+		map.clear();
+	}
+
+	public JSONObjectWrapper put(String key, Object value) throws JSONException {
+		if (value == null)
+			super.put(key, JSONObject.NULL);
+		else
+			super.put(key, value);
+		if (map == null)
+			map = new LinkedHashMap<String, Object>();
+		if (!map.containsKey(key))
+			map.put(key, value);
+		return this;
+	}
+
+	public Object remove(String key) {
+		if (map.containsKey(key))
+			map.remove(key);
+		return super.remove(key);
+	}
+}

From 53eee0dc54291213aede94567bcaf6ce342bd0a0 Mon Sep 17 00:00:00 2001
From: iroqueta <iroqueta@genexus.com>
Date: Thu, 23 May 2024 08:32:03 -0300
Subject: [PATCH 03/24] Remove org.json lib fork and use new version of the API
 https://github.com/stleary/JSON-java Issue: 105607 d844074

---
 .../main/java/com/genexus/internet/HttpAjaxContext.java    | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/gxweb/src/main/java/com/genexus/internet/HttpAjaxContext.java b/gxweb/src/main/java/com/genexus/internet/HttpAjaxContext.java
index efd9a2883..78851c5a0 100644
--- a/gxweb/src/main/java/com/genexus/internet/HttpAjaxContext.java
+++ b/gxweb/src/main/java/com/genexus/internet/HttpAjaxContext.java
@@ -24,6 +24,7 @@
 import com.genexus.webpanels.WebUtils;
 import org.json.JSONArray;
 import org.json.JSONException;
+import org.json.JSONObject;
 import com.genexus.json.JSONObjectWrapper;
 
 public class HttpAjaxContext extends HttpContextWeb
@@ -896,11 +897,13 @@ private JSONObjectWrapper getControlProps(JSONObjectWrapper obj, String Control)
         {
 			JSONObjectWrapper ctrlProps = null;
             try {
-                ctrlProps = new JSONObjectWrapper(obj.optJSONObject(Control));
-                if (ctrlProps == null) {
+				JSONObject crtPropsAux = obj.optJSONObject(Control);
+                if (crtPropsAux == null) {
                     ctrlProps = new JSONObjectWrapper();
                     obj.put(Control, ctrlProps);
                 }
+				else
+					ctrlProps = new JSONObjectWrapper(crtPropsAux);
             } catch (JSONException e) {
             }
             return ctrlProps;

From 04003dc7ac9beb52e9bb1948cdeedb9af48ca077 Mon Sep 17 00:00:00 2001
From: iroqueta <iroqueta@genexus.com>
Date: Thu, 23 May 2024 12:14:57 -0300
Subject: [PATCH 04/24] Remove org.json lib fork and use new version of the API
 https://github.com/stleary/JSON-java Issue: 105607 d844074

---
 common/src/main/java/com/genexus/xml/GXXMLSerializable.java | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/common/src/main/java/com/genexus/xml/GXXMLSerializable.java b/common/src/main/java/com/genexus/xml/GXXMLSerializable.java
index e9319c148..1b49d2547 100644
--- a/common/src/main/java/com/genexus/xml/GXXMLSerializable.java
+++ b/common/src/main/java/com/genexus/xml/GXXMLSerializable.java
@@ -354,6 +354,8 @@ public void FromJSONObject(Object obj)
 		}
 		else
 		{
+			if (obj instanceof JSONObject)
+				obj = new JSONObjectWrapper((JSONObject)obj);
 			Iterator it = getFromJSONObjectOrderIterator(((JSONObjectWrapper)obj).keys());
 			while(it.hasNext())
 			{

From 11cfef301935b00ec5f4582d3f3a6419fce28e2e Mon Sep 17 00:00:00 2001
From: iroqueta <iroqueta@genexus.com>
Date: Thu, 23 May 2024 15:57:48 -0300
Subject: [PATCH 05/24] Remove org.json lib fork and use new version of the API
 https://github.com/stleary/JSON-java Issue: 105607 d844074

---
 gxweb/src/main/java/com/genexus/webpanels/GXWebRow.java | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/gxweb/src/main/java/com/genexus/webpanels/GXWebRow.java b/gxweb/src/main/java/com/genexus/webpanels/GXWebRow.java
index 08ccc4942..06f5b54cb 100644
--- a/gxweb/src/main/java/com/genexus/webpanels/GXWebRow.java
+++ b/gxweb/src/main/java/com/genexus/webpanels/GXWebRow.java
@@ -1,5 +1,6 @@
 package com.genexus.webpanels;
 
+import java.util.ArrayList;
 import java.util.Iterator;
 
 import com.genexus.CommonUtil;
@@ -114,6 +115,7 @@ public void AddColumnProperties(int valueIndex, boolean valueWithProps, Object[]
 			boolean equal =  it != null && !((HttpContext)context.getHttpContext()).isAjaxCallMode() ;
             Object current = null;
 
+			ArrayList<Object> myArrayList = new ArrayList<Object>();;
             for (int i = props.length - 1; i >= 0; i--)
             {
                 Object prop = props[i];
@@ -129,7 +131,7 @@ public void AddColumnProperties(int valueIndex, boolean valueWithProps, Object[]
                     {
                         equal = false;
                         try{
-							colProps.put(0, prop);
+							myArrayList.add(0, prop);
                         }catch (JSONException e){}
                         if (it == null)
                             colPropsRev.put(prop);
@@ -143,6 +145,9 @@ else if (valueWithProps)
                     _Values.put(prop);
                 }
             }
+			if (myArrayList.size() > 0)
+				colProps.putAll(myArrayList);
+
             if (this._parentGrid != null && it == null) // If is the first Row.
             {
                 this._parentGrid.GetColsPropsCommon().add(colPropsRev);

From 8611985d98c3f016e4928ff3a428e32d2b3b3553 Mon Sep 17 00:00:00 2001
From: iroqueta <iroqueta@genexus.com>
Date: Fri, 24 May 2024 09:15:41 -0300
Subject: [PATCH 06/24] Remove org.json lib fork and use new version of the API
 https://github.com/stleary/JSON-java Issue: 105607 d844074

---
 gxweb/src/main/java/com/genexus/webpanels/GXWebPanel.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gxweb/src/main/java/com/genexus/webpanels/GXWebPanel.java b/gxweb/src/main/java/com/genexus/webpanels/GXWebPanel.java
index 6dc8aca8a..7e6f8ec61 100644
--- a/gxweb/src/main/java/com/genexus/webpanels/GXWebPanel.java
+++ b/gxweb/src/main/java/com/genexus/webpanels/GXWebPanel.java
@@ -550,7 +550,7 @@ private void parseInputJSonMessage(String jsonMessage, GXWebPanel targetObj) thr
 					}
 				}
 				if (objMessage.has("grids"))
-					parseGridsDataParms((JSONObjectWrapper) objMessage.get("grids"));
+					parseGridsDataParms((JSONObject) objMessage.get("grids"));
 				if (objMessage.has("grid"))
 					grid = objMessage.getInt("grid");
 				else
@@ -573,7 +573,7 @@ private void parseInputJSonMessage(String jsonMessage, GXWebPanel targetObj) thr
 			}
 		}
 
-		private void parseGridsDataParms(JSONObjectWrapper gxGrids)
+		private void parseGridsDataParms(JSONObject gxGrids)
 		{
 			JSONArray gridNames = gxGrids.names();
 			if (gridNames != null)

From 6ae833ff0ffc2330d58b4ff2daf17eeeff3cf26b Mon Sep 17 00:00:00 2001
From: iroqueta <iroqueta@genexus.com>
Date: Fri, 24 May 2024 18:25:14 -0300
Subject: [PATCH 07/24] Remove org.json lib fork and use new version of the API
 https://github.com/stleary/JSON-java Issue: 105607 d844074

---
 gxweb/src/main/java/com/genexus/webpanels/GXWebPanel.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gxweb/src/main/java/com/genexus/webpanels/GXWebPanel.java b/gxweb/src/main/java/com/genexus/webpanels/GXWebPanel.java
index 7e6f8ec61..0a7d8fcef 100644
--- a/gxweb/src/main/java/com/genexus/webpanels/GXWebPanel.java
+++ b/gxweb/src/main/java/com/genexus/webpanels/GXWebPanel.java
@@ -684,7 +684,7 @@ private void parseMetadata() {
 			}
 		}
 
-		private void SetNullableScalarOrCollectionValue(JSONObjectWrapper parm, Object value, JSONArray columnValues) throws JSONException, Exception
+		private void SetNullableScalarOrCollectionValue(JSONObject parm, Object value, JSONArray columnValues) throws JSONException, Exception
 		{
 			String nullableAttribute = parm.optString("nullAv", null);
 			if (nullableAttribute != null && value.toString().length() == 0)
@@ -877,7 +877,7 @@ private Object[] beforeInvoke() throws JSONException, Exception {
 				int len = dynAjaxEventContext.inParmsMetadata.length();
 				boolean multipart = targetObj.httpContext.isMultipartContent();
 				for (int i = 0; i < len; i++) {
-					JSONObjectWrapper parm = (JSONObjectWrapper) dynAjaxEventContext.inParmsMetadata.getJSONObject(i);
+					JSONObject parm = (JSONObject) dynAjaxEventContext.inParmsMetadata.getJSONObject(i);
 					try{
 						if (parm.has("postForm"))
 						{

From 9b7948760785d2baec40b072087ef221cf4ac265 Mon Sep 17 00:00:00 2001
From: iroqueta <iroqueta@genexus.com>
Date: Sun, 26 May 2024 22:11:17 -0300
Subject: [PATCH 08/24] Remove org.json lib fork and use new version of the API
 https://github.com/stleary/JSON-java Issue: 105607 d844074

---
 gxweb/src/main/java/com/genexus/webpanels/GXWebPanel.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gxweb/src/main/java/com/genexus/webpanels/GXWebPanel.java b/gxweb/src/main/java/com/genexus/webpanels/GXWebPanel.java
index 0a7d8fcef..a1cd61420 100644
--- a/gxweb/src/main/java/com/genexus/webpanels/GXWebPanel.java
+++ b/gxweb/src/main/java/com/genexus/webpanels/GXWebPanel.java
@@ -580,7 +580,7 @@ private void parseGridsDataParms(JSONObject gxGrids)
 			{
 				for (int i = 0; i < gridNames.length(); i++) {
 					try {
-						JSONObjectWrapper grid = (JSONObjectWrapper)gxGrids.get(gridNames.getString(i));
+						JSONObject grid = (JSONObject)gxGrids.get(gridNames.getString(i));
 						if (grid.getInt("id") != 0 && !grid.getString("lastRow").equals(""))
 						{
 							int lastRow = grid.getInt("lastRow") + 1;
@@ -914,7 +914,7 @@ private Object[] beforeInvoke() throws JSONException, Exception {
 									//Case for each line command or collection based grid
 									int colDataLen = (allCollData == null) ? 0 : allCollData.length();
 									for (int k = 0; k < colDataLen; k++) {
-										JSONObjectWrapper columnData = (JSONObjectWrapper)allCollData.get(k);
+										JSONObject columnData = (JSONObject)allCollData.get(k);
 										parentRow = (String)columnData.get("pRow");
 										columnValues = (JSONArray)columnData.get("c");
 										if (columnData.has("hsh")) {
@@ -1012,7 +1012,7 @@ private Object[] beforeInvoke() throws JSONException, Exception {
 									columnValues = (value instanceof JSONArray ? (JSONArray)value : null);
 									if (parm.has("hsh") && httpContext.useSecurityTokenValidation()) {
 										try {
-											JSONObjectWrapper hashObj = (JSONObjectWrapper)((hash_i < inHashValues.length()) ? inHashValues.get(hash_i) : new JSONObjectWrapper());
+											JSONObject hashObj = (JSONObject)((hash_i < inHashValues.length()) ? inHashValues.get(hash_i) : new JSONObject());
 											String sRow = "";
 											String hash = "";
 											try {

From 75563b225e698e12a3c0c0a98678f9b5e4b4d6a0 Mon Sep 17 00:00:00 2001
From: iroqueta <iroqueta@genexus.com>
Date: Mon, 27 May 2024 18:09:33 -0300
Subject: [PATCH 09/24] Remove org.json lib fork and use new version of the API
 https://github.com/stleary/JSON-java Issue: 105607 d844074

---
 gxweb/src/main/java/com/genexus/webpanels/GXWebPanel.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gxweb/src/main/java/com/genexus/webpanels/GXWebPanel.java b/gxweb/src/main/java/com/genexus/webpanels/GXWebPanel.java
index a1cd61420..24dd58ccd 100644
--- a/gxweb/src/main/java/com/genexus/webpanels/GXWebPanel.java
+++ b/gxweb/src/main/java/com/genexus/webpanels/GXWebPanel.java
@@ -581,7 +581,7 @@ private void parseGridsDataParms(JSONObject gxGrids)
 				for (int i = 0; i < gridNames.length(); i++) {
 					try {
 						JSONObject grid = (JSONObject)gxGrids.get(gridNames.getString(i));
-						if (grid.getInt("id") != 0 && !grid.getString("lastRow").equals(""))
+						if (grid.getInt("id") != 0 && !grid.get("lastRow").toString().equals(""))
 						{
 							int lastRow = grid.getInt("lastRow") + 1;
 							try{
@@ -609,7 +609,7 @@ private void parseGXStateParms(JSONObject gxState) {
 					String key;
 					try {
 						key = names.getString(i);
-						String value = gxState.getString(key);
+						String value = gxState.get(key).toString();
 						if ((!targetObj.httpContext.isFileParm( key)) && (!value.equals(""))) {
 							targetObj.httpContext.changePostValue(key, value);
 						}

From 95be0dca1257d2b18eb447b98c3948e3d6039e28 Mon Sep 17 00:00:00 2001
From: iroqueta <iroqueta@genexus.com>
Date: Tue, 28 May 2024 13:00:35 -0300
Subject: [PATCH 10/24] Remove org.json lib fork and use new version of the API
 https://github.com/stleary/JSON-java Issue: 105607 d844074

---
 java/src/main/java/com/genexus/webpanels/GXMultiCall.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/java/src/main/java/com/genexus/webpanels/GXMultiCall.java b/java/src/main/java/com/genexus/webpanels/GXMultiCall.java
index 59fdcf51d..2b8f51bff 100644
--- a/java/src/main/java/com/genexus/webpanels/GXMultiCall.java
+++ b/java/src/main/java/com/genexus/webpanels/GXMultiCall.java
@@ -85,7 +85,7 @@ public static void callProcRest(ModelContext context, String jsonStr) throws Exc
 			Object [] params = new Object[parmCount];
 			for(int j = 0; j < parmCount; j++)
 			{
-				params[j] = GXutil.convertObjectTo(procParms.getString(j), parameters[j]);
+				params[j] = GXutil.convertObjectTo(procParms.get(j).toString(), parameters[j]);
 			}
 			com.genexus.db.DynamicExecute.dynamicExecute(modelContext, remoteHandle, modelContext.packageClass, appPackage + procName, params);
 		}

From a64fd32b053ed6e62f4058ab331213f1f2d914e5 Mon Sep 17 00:00:00 2001
From: iroqueta <iroqueta@genexus.com>
Date: Tue, 28 May 2024 14:41:51 -0300
Subject: [PATCH 11/24] Remove org.json lib fork and use new version of the API
 https://github.com/stleary/JSON-java Issue: 105607

---
 gxweb/src/main/java/com/genexus/internet/HttpAjaxContext.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gxweb/src/main/java/com/genexus/internet/HttpAjaxContext.java b/gxweb/src/main/java/com/genexus/internet/HttpAjaxContext.java
index 78851c5a0..ac2c9ea6a 100644
--- a/gxweb/src/main/java/com/genexus/internet/HttpAjaxContext.java
+++ b/gxweb/src/main/java/com/genexus/internet/HttpAjaxContext.java
@@ -811,7 +811,7 @@ private JSONObjectWrapper getGxObject(JSONArray array, String CmpContext, boolea
 			int len = array.length();
 			for(int i=0; i<len; i++)
 			{
-				obj = new JSONObjectWrapper(array.getJSONObject(i));
+				obj = (JSONObjectWrapper)array.getJSONObject(i);
 				if (obj.getBoolean("IsMasterPage") == IsMasterPage &&  obj.getString("CmpContext").equals(CmpContext))
 				{
 					return obj;

From 5f66ab7e82bdbd9350e08b576160d548469b1495 Mon Sep 17 00:00:00 2001
From: iroqueta <iroqueta@genexus.com>
Date: Tue, 28 May 2024 15:18:08 -0300
Subject: [PATCH 12/24] Remove org.json lib fork and use new version of the API
 https://github.com/stleary/JSON-java Issue: 105607

---
 common/src/main/java/com/genexus/json/JSONObjectWrapper.java | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/common/src/main/java/com/genexus/json/JSONObjectWrapper.java b/common/src/main/java/com/genexus/json/JSONObjectWrapper.java
index d08435587..e2bbacf65 100644
--- a/common/src/main/java/com/genexus/json/JSONObjectWrapper.java
+++ b/common/src/main/java/com/genexus/json/JSONObjectWrapper.java
@@ -59,8 +59,7 @@ public JSONObjectWrapper put(String key, Object value) throws JSONException {
 			super.put(key, value);
 		if (map == null)
 			map = new LinkedHashMap<String, Object>();
-		if (!map.containsKey(key))
-			map.put(key, value);
+		map.put(key, value);
 		return this;
 	}
 

From af1c60c396bb8b523c43758f09883739727d157d Mon Sep 17 00:00:00 2001
From: iroqueta <iroqueta@genexus.com>
Date: Wed, 29 May 2024 15:23:24 -0300
Subject: [PATCH 13/24] Remove org.json lib fork and use new version of the API
 https://github.com/stleary/JSON-java Issue: 105607

---
 gxweb/src/main/java/com/genexus/webpanels/GXWebPanel.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gxweb/src/main/java/com/genexus/webpanels/GXWebPanel.java b/gxweb/src/main/java/com/genexus/webpanels/GXWebPanel.java
index 24dd58ccd..bf2400007 100644
--- a/gxweb/src/main/java/com/genexus/webpanels/GXWebPanel.java
+++ b/gxweb/src/main/java/com/genexus/webpanels/GXWebPanel.java
@@ -585,8 +585,8 @@ private void parseGridsDataParms(JSONObject gxGrids)
 						{
 							int lastRow = grid.getInt("lastRow") + 1;
 							try{
-								SetFieldValue("sGXsfl_" + grid.getString("id") + "_idx", String.format("%04d", lastRow) + pRow);
-								SetFieldValue("nGXsfl_" + grid.getString("id") + "_idx", String.valueOf(lastRow));
+								SetFieldValue("sGXsfl_" + grid.get("id").toString() + "_idx", String.format("%04d", lastRow) + pRow);
+								SetFieldValue("nGXsfl_" + grid.get("id").toString() + "_idx", String.valueOf(lastRow));
 							}
 							catch(Exception ex1)
 							{
@@ -937,7 +937,7 @@ private Object[] beforeInvoke() throws JSONException, Exception {
 											}
 											else
 											{
-												strValue = columnValues.getString(j);
+												strValue = columnValues.get(j).toString();
 											}
 											targetObj.httpContext.changePostValue(varName, strValue);
 											rowIdx++;

From 15554188c30bcd84814d4664b99eab7a85b515f1 Mon Sep 17 00:00:00 2001
From: iroqueta <iroqueta@genexus.com>
Date: Wed, 29 May 2024 18:00:49 -0300
Subject: [PATCH 14/24] Remove org.json lib fork and use new version of the API
 https://github.com/stleary/JSON-java Issue: 105607

---
 common/src/main/java/com/genexus/json/JSONObjectWrapper.java | 5 ++++-
 .../src/main/java/com/genexus/internet/HttpAjaxContext.java  | 2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/common/src/main/java/com/genexus/json/JSONObjectWrapper.java b/common/src/main/java/com/genexus/json/JSONObjectWrapper.java
index e2bbacf65..11c51f3a4 100644
--- a/common/src/main/java/com/genexus/json/JSONObjectWrapper.java
+++ b/common/src/main/java/com/genexus/json/JSONObjectWrapper.java
@@ -59,7 +59,10 @@ public JSONObjectWrapper put(String key, Object value) throws JSONException {
 			super.put(key, value);
 		if (map == null)
 			map = new LinkedHashMap<String, Object>();
-		map.put(key, value);
+		if (map.containsKey(key))
+			map.replace(key, value);
+		else
+			map.put(key, value);
 		return this;
 	}
 
diff --git a/gxweb/src/main/java/com/genexus/internet/HttpAjaxContext.java b/gxweb/src/main/java/com/genexus/internet/HttpAjaxContext.java
index ac2c9ea6a..3a09a5312 100644
--- a/gxweb/src/main/java/com/genexus/internet/HttpAjaxContext.java
+++ b/gxweb/src/main/java/com/genexus/internet/HttpAjaxContext.java
@@ -903,7 +903,7 @@ private JSONObjectWrapper getControlProps(JSONObjectWrapper obj, String Control)
                     obj.put(Control, ctrlProps);
                 }
 				else
-					ctrlProps = new JSONObjectWrapper(crtPropsAux);
+					ctrlProps = (JSONObjectWrapper)crtPropsAux;
             } catch (JSONException e) {
             }
             return ctrlProps;

From be4927775d3fa76afe83965b33c07ffd89a8167f Mon Sep 17 00:00:00 2001
From: iroqueta <iroqueta@genexus.com>
Date: Fri, 31 May 2024 11:40:20 -0300
Subject: [PATCH 15/24] Remove org.json lib fork and use new version of the API
 https://github.com/stleary/JSON-java Issue: 105607

---
 .../java/com/genexus/internet/GXRestAPIClient.java   | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/java/src/main/java/com/genexus/internet/GXRestAPIClient.java b/java/src/main/java/com/genexus/internet/GXRestAPIClient.java
index ef548eb48..de4e50f25 100644
--- a/java/src/main/java/com/genexus/internet/GXRestAPIClient.java
+++ b/java/src/main/java/com/genexus/internet/GXRestAPIClient.java
@@ -334,9 +334,9 @@ public String getJsonStr(String varName) {
 		try {
 			if (jsonResponse != null) {
 				if (jsonResponse.has(varName))
-					jsonstr = jsonResponse.getString(varName);
+					jsonstr = jsonResponse.get(varName).toString();
 				else if (jsonResponse.length() == 1 && jsonResponse.has(""))
-					jsonstr = jsonResponse.getString("");								
+					jsonstr = jsonResponse.get("").toString();
 			}
 			else {
 				errorCode = RESPONSE_ERROR_CODE;
@@ -368,10 +368,10 @@ public <T extends GXXMLSerializable> T getBodyObj(String varName, Class<T> sdtCl
 			if (jsonResponse != null) {
 				Boolean dSuccess = false;
 				if (jsonResponse.has(varName) && jsonResponse.length() == 1) {
-					dSuccess = sdt.fromJSonString(jsonResponse.getString(varName), null);
+					dSuccess = sdt.fromJSonString(jsonResponse.get(varName).toString(), null);
 				} 
 				else if (jsonResponse.length() == 1 && jsonResponse.has("")) {
-					dSuccess = sdt.fromJSonString(jsonResponse.getString(""), null);
+					dSuccess = sdt.fromJSonString(jsonResponse.get("").toString(), null);
 				} 
 				else if (jsonResponse.length()>= 1) {
 					dSuccess = sdt.fromJSonString(httpClient.getString(), null);			
@@ -455,10 +455,10 @@ public <T extends Object> GXSimpleCollection<T> getBodyCollection(String varName
         } 		
 		try {
 			if (jsonResponse.has(varName)) {
-				coll.fromJSonString(jsonResponse.getString(varName), null);
+				coll.fromJSonString(jsonResponse.get(varName).toString(), null);
 			} 
 			else if (jsonResponse.length() == 1 && jsonResponse.has("")) {
-				coll.fromJSonString(jsonResponse.getString(varName), null);
+				coll.fromJSonString(jsonResponse.get(varName).toString(), null);
 			} 
 		} 
 		catch (JSONException e) {

From 457df2a54022b5241b53d440829b91d58457a083 Mon Sep 17 00:00:00 2001
From: iroqueta <iroqueta@genexus.com>
Date: Fri, 31 May 2024 12:04:50 -0300
Subject: [PATCH 16/24] Remove org.json lib fork and use new version of the API
 https://github.com/stleary/JSON-java Issue: 105607

---
 common/src/main/java/com/genexus/util/GXProperties.java | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/common/src/main/java/com/genexus/util/GXProperties.java b/common/src/main/java/com/genexus/util/GXProperties.java
index 1d6dc111a..93c0d8efc 100644
--- a/common/src/main/java/com/genexus/util/GXProperties.java
+++ b/common/src/main/java/com/genexus/util/GXProperties.java
@@ -130,9 +130,8 @@ public boolean fromJSonString(String s, GXBaseCollection < SdtMessages_Message >
 		if (!s.isEmpty()) {
 			try {
 				JSONObjectWrapper jObj = new JSONObjectWrapper(s);
-				Iterator < String > keys = jObj.keys();
-				while (keys.hasNext()) {
-					String key = keys.next();
+				for (Map.Entry<String, Object> e : jObj.entrySet()) {
+					String key = e.getKey();
 					this.put(key, jObj.get(key).toString());
 				}
 				return true;

From bf106f1c8485fbf23b8dd34390bcc67d42d1630a Mon Sep 17 00:00:00 2001
From: iroqueta <iroqueta@genexus.com>
Date: Thu, 6 Jun 2024 19:19:07 -0300
Subject: [PATCH 17/24] Remove org.json lib fork and use new version of the API
 https://github.com/stleary/JSON-java Issue: 105607

---
 .../com/genexus/json/JSONObjectWrapper.java   |  8 +++++-
 .../com/genexus/json/JSONTokenerWrapper.java  | 25 +++++++++++++++++++
 .../com/genexus/xml/GXXMLSerializable.java    |  8 +++---
 3 files changed, 37 insertions(+), 4 deletions(-)
 create mode 100644 common/src/main/java/com/genexus/json/JSONTokenerWrapper.java

diff --git a/common/src/main/java/com/genexus/json/JSONObjectWrapper.java b/common/src/main/java/com/genexus/json/JSONObjectWrapper.java
index 11c51f3a4..067e53ed0 100644
--- a/common/src/main/java/com/genexus/json/JSONObjectWrapper.java
+++ b/common/src/main/java/com/genexus/json/JSONObjectWrapper.java
@@ -15,7 +15,13 @@ public JSONObjectWrapper() {
 	}
 
 	public JSONObjectWrapper(String string) {
-		super(string);
+		super(new JSONTokenerWrapper(string));
+		if (map == null)
+			map = new LinkedHashMap<String, Object>();
+	}
+
+	public JSONObjectWrapper(JSONTokenerWrapper token) {
+		super(token);
 		if (map == null)
 			map = new LinkedHashMap<String, Object>();
 	}
diff --git a/common/src/main/java/com/genexus/json/JSONTokenerWrapper.java b/common/src/main/java/com/genexus/json/JSONTokenerWrapper.java
new file mode 100644
index 000000000..6094ee009
--- /dev/null
+++ b/common/src/main/java/com/genexus/json/JSONTokenerWrapper.java
@@ -0,0 +1,25 @@
+package com.genexus.json;
+
+import org.json.JSONTokener;
+import org.json.JSONException;
+
+public class JSONTokenerWrapper extends JSONTokener{
+
+	public JSONTokenerWrapper(String string) {
+		super(string);
+	}
+
+	public Object nextValue() throws JSONException {
+		char c = this.nextClean();
+		this.back();
+		if (c == '{') {
+			try {
+				return new JSONObjectWrapper(this);
+			} catch (StackOverflowError e) {
+				throw new JSONException("JSON Array or Object depth too large to process.", e);
+			}
+		}
+		else
+			return super.nextValue();
+	}
+}
diff --git a/common/src/main/java/com/genexus/xml/GXXMLSerializable.java b/common/src/main/java/com/genexus/xml/GXXMLSerializable.java
index 1b49d2547..9f27167bd 100644
--- a/common/src/main/java/com/genexus/xml/GXXMLSerializable.java
+++ b/common/src/main/java/com/genexus/xml/GXXMLSerializable.java
@@ -13,6 +13,7 @@
 import java.io.Serializable;
 import java.util.Iterator;
 import java.lang.reflect.Method;
+import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
 import com.genexus.internet.IGxJSONAble;
@@ -291,14 +292,15 @@ public Object GetJSONObject(boolean includeState, boolean includeNoInitialized)
 	}
 
 	/*Recorre el iterador y pone los _N del campo al final asi no se pierden los valores null cuando se asigna el valor al campo*/
-	private Iterator getFromJSONObjectOrderIterator(Iterator it)
+	private Iterator getFromJSONObjectOrderIterator(Iterator<Map.Entry<String, Object>> it)
 	{
 		java.util.Vector<String> v = new java.util.Vector<String>();
 		java.util.Vector<String> vAtEnd = new java.util.Vector<String>();
 		String name;
         while(it.hasNext())
         {
-        	name = (String)it.next();
+			Map.Entry<String, Object> entry = it.next();
+        	name = entry.getKey();
 	        String map = getJsonMap(name);
 	        String className = CommonUtil.classNameNoPackage(this.getClass());
 			Method getMethod = getMethod(GET_METHOD_NAME + className + "_" + (map != null? map : name));
@@ -356,7 +358,7 @@ public void FromJSONObject(Object obj)
 		{
 			if (obj instanceof JSONObject)
 				obj = new JSONObjectWrapper((JSONObject)obj);
-			Iterator it = getFromJSONObjectOrderIterator(((JSONObjectWrapper)obj).keys());
+			Iterator it = getFromJSONObjectOrderIterator(((JSONObjectWrapper)obj).entrySet().iterator());
 			while(it.hasNext())
 			{
 				name = (String)it.next();

From 1bae3d3e7bcf512282c8fafb11fbafe6d8f1ff68 Mon Sep 17 00:00:00 2001
From: iroqueta <iroqueta@genexus.com>
Date: Fri, 7 Jun 2024 16:33:41 -0300
Subject: [PATCH 18/24] Remove org.json lib fork and use new version of the API
 https://github.com/stleary/JSON-java Issue: 105607

---
 .../com/genexus/json/JSONObjectWrapper.java    | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/common/src/main/java/com/genexus/json/JSONObjectWrapper.java b/common/src/main/java/com/genexus/json/JSONObjectWrapper.java
index 067e53ed0..7c1f8085c 100644
--- a/common/src/main/java/com/genexus/json/JSONObjectWrapper.java
+++ b/common/src/main/java/com/genexus/json/JSONObjectWrapper.java
@@ -28,18 +28,14 @@ public JSONObjectWrapper(JSONTokenerWrapper token) {
 
 	public JSONObjectWrapper(Map<?,?> m) {
 		super(m);
-		if (map == null)
-			map = new LinkedHashMap<String, Object>();
-		else {
-			map = new LinkedHashMap<String, Object>(m.size());
-			for (final Entry<?, ?> e : m.entrySet()) {
-				if (e.getKey() == null) {
-					throw new NullPointerException("Null key.");
-				}
-				final Object value = e.getValue();
-				if (value != null)
-					this.map.put(String.valueOf(e.getKey()), value);
+		map = new LinkedHashMap<String, Object>(m.size());
+		for (final Entry<?, ?> e : m.entrySet()) {
+			if (e.getKey() == null) {
+				throw new NullPointerException("Null key.");
 			}
+			final Object value = e.getValue();
+			if (value != null)
+				this.map.put(String.valueOf(e.getKey()), value);
 		}
 	}
 

From 30fdb7fc5a2967a2771e1194f25ac510e6062197 Mon Sep 17 00:00:00 2001
From: iroqueta <iroqueta@genexus.com>
Date: Fri, 7 Jun 2024 19:15:21 -0300
Subject: [PATCH 19/24] Remove org.json lib fork and use new version of the API
 https://github.com/stleary/JSON-java Issue: 105607

---
 gxweb/src/main/java/com/genexus/webpanels/GXWebPanel.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gxweb/src/main/java/com/genexus/webpanels/GXWebPanel.java b/gxweb/src/main/java/com/genexus/webpanels/GXWebPanel.java
index bf2400007..406862d27 100644
--- a/gxweb/src/main/java/com/genexus/webpanels/GXWebPanel.java
+++ b/gxweb/src/main/java/com/genexus/webpanels/GXWebPanel.java
@@ -929,7 +929,7 @@ private Object[] beforeInvoke() throws JSONException, Exception {
 										for (int j = 0; j < colValuesLen; j++) {
 											String varName = String.format("%s%s_%s%s", cmpContext, (String)parm.get("fld"), String.format("%04d", rowIdx), parentRow);
 											objValue = columnValues.get(j);
-											if (objValue.getClass() == Double.class)
+											if (objValue.getClass() == java.math.BigDecimal.class || objValue.getClass() == Double.class)
 											{
 												DecimalFormat df = (DecimalFormat) NumberFormat.getInstance(localUtil.getLocale());
 												df.setMaximumFractionDigits(Integer.MAX_VALUE);
@@ -975,7 +975,7 @@ private Object[] beforeInvoke() throws JSONException, Exception {
 											for (int j = 0; j < hideCodeValuesLen; j++) {
 												String varName = String.format("%sGXHC%s_%s%s", cmpContext, (String)parm.get("fld"), String.format("%04d", rowIdx), parentRow);
 												objValue = hideCodeValues.get(j);
-												if (objValue.getClass() == Double.class)
+												if (objValue.getClass() == java.math.BigDecimal.class || objValue.getClass() == Double.class)
 												{
 													DecimalFormat df = (DecimalFormat) NumberFormat.getInstance(localUtil.getLocale());
 													df.setMaximumFractionDigits(Integer.MAX_VALUE);

From 8187fbae729525904e0174b7c17e79263a3fd366 Mon Sep 17 00:00:00 2001
From: iroqueta <iroqueta@genexus.com>
Date: Tue, 11 Jun 2024 13:13:47 -0300
Subject: [PATCH 20/24] Remove org.json lib fork and use new version of the API
 https://github.com/stleary/JSON-java Issue: 105607

---
 .../java/com/genexus/GXSimpleCollection.java  | 14 ++++++-------
 .../com/genexus/json/JSONArrayWrapper.java    | 20 +++++++++++++++++++
 .../com/genexus/json/JSONObjectWrapper.java   |  2 +-
 .../com/genexus/xml/GXXMLSerializable.java    | 11 +++++++---
 4 files changed, 36 insertions(+), 11 deletions(-)
 create mode 100644 common/src/main/java/com/genexus/json/JSONArrayWrapper.java

diff --git a/common/src/main/java/com/genexus/GXSimpleCollection.java b/common/src/main/java/com/genexus/GXSimpleCollection.java
index 69c6e4572..574e8ce22 100644
--- a/common/src/main/java/com/genexus/GXSimpleCollection.java
+++ b/common/src/main/java/com/genexus/GXSimpleCollection.java
@@ -16,10 +16,10 @@
 import com.genexus.internet.IGxJSONAble;
 import com.genexus.internet.IGxJSONSerializable;
 import com.genexus.internet.StringCollection;
+import com.genexus.json.JSONArrayWrapper;
 import com.genexus.util.GXMap;
 import com.genexus.util.Quicksort;
 import com.genexus.xml.XMLReader;
-
 import com.genexus.xml.XMLWriter;
 
 import org.json.JSONArray;
@@ -33,7 +33,7 @@ public class GXSimpleCollection<T> extends GXBaseList<T> {
 	protected String xmlElementsName;
 	protected String containedXmlNamespace = "";
 	protected int remoteHandle = -1;
-	protected JSONArray jsonArr = new JSONArray();
+	protected JSONArrayWrapper jsonArr = new JSONArrayWrapper();
 
 	public GXSimpleCollection()
 	{
@@ -979,7 +979,7 @@ public void tojson()
 	}
 	public void tojson(boolean includeState)
 	{
-		jsonArr = new JSONArray();
+		jsonArr = new JSONArrayWrapper();
 		int size = size();
 		for (int i = 0; i < size; i++)
 		{
@@ -1118,7 +1118,7 @@ public boolean fromJSonString(String s, GXBaseCollection<SdtMessages_Message> me
 	{
 		try
 		{
-			jsonArr = new JSONArray(s);
+			jsonArr = new JSONArrayWrapper(s);
 			FromJSONObject(jsonArr);
 			return true;
 		}
@@ -1144,7 +1144,7 @@ public void fromStringCollectionJsonString(String s)
 		this.clear();
 		try
 		{
-			jsonArr = new JSONArray(s);
+			jsonArr = new JSONArrayWrapper(s);
 			for (int i = 0; i < jsonArr.length(); i++)
 			{
 				JSONArray jsonObj = jsonArr.getJSONArray(i);
@@ -1224,7 +1224,7 @@ public void fromStringCollectionClientJsonString(String s)
 	{
 		this.clear();
 		try {
-			jsonArr = new JSONArray(s);
+			jsonArr = new JSONArrayWrapper(s);
 		} catch (JSONException e) {
 			// TODO Auto-generated catch block
 			e.printStackTrace();
@@ -1291,7 +1291,7 @@ private boolean processArray(GxUnknownObjectCollection oldParent, GxUnknownObjec
 
 	public JSONArray getRawJSONArray()
 	{
-		return jsonArr;
+		return (JSONArray)jsonArr;
 	}
 
 	// toString of GxUnknownObjectCollection as client proc expect, table info + rows.
diff --git a/common/src/main/java/com/genexus/json/JSONArrayWrapper.java b/common/src/main/java/com/genexus/json/JSONArrayWrapper.java
new file mode 100644
index 000000000..260cb4c6c
--- /dev/null
+++ b/common/src/main/java/com/genexus/json/JSONArrayWrapper.java
@@ -0,0 +1,20 @@
+package com.genexus.json;
+
+import org.json.JSONArray;
+
+import java.util.LinkedHashMap;
+
+public class JSONArrayWrapper extends JSONArray implements java.io.Serializable{
+
+	public JSONArrayWrapper() {
+		super();
+	}
+
+	public JSONArrayWrapper(String string) {
+		super(string);
+	}
+
+	public JSONArrayWrapper(JSONArray array) {
+		super(array);
+	}
+}
diff --git a/common/src/main/java/com/genexus/json/JSONObjectWrapper.java b/common/src/main/java/com/genexus/json/JSONObjectWrapper.java
index 7c1f8085c..de3677b7e 100644
--- a/common/src/main/java/com/genexus/json/JSONObjectWrapper.java
+++ b/common/src/main/java/com/genexus/json/JSONObjectWrapper.java
@@ -5,7 +5,7 @@
 import java.util.Map.Entry;
 import org.json.JSONException;
 import org.json.JSONObject;
-public class JSONObjectWrapper extends JSONObject{
+public class JSONObjectWrapper extends JSONObject implements java.io.Serializable{
 	private Map<String, Object> map;
 
 	public JSONObjectWrapper() {
diff --git a/common/src/main/java/com/genexus/xml/GXXMLSerializable.java b/common/src/main/java/com/genexus/xml/GXXMLSerializable.java
index 9f27167bd..3f7a4c425 100644
--- a/common/src/main/java/com/genexus/xml/GXXMLSerializable.java
+++ b/common/src/main/java/com/genexus/xml/GXXMLSerializable.java
@@ -3,12 +3,13 @@
 import com.genexus.common.classes.AbstractGXFile;
 import com.genexus.ModelContext;
 import com.genexus.common.interfaces.SpecificImplementation;
+import com.genexus.json.JSONArrayWrapper;
+import com.genexus.json.JSONObjectWrapper;
 import com.genexus.util.GXProperties;
 
 import org.json.JSONArray;
 import org.json.JSONException;
 import org.json.JSONObject;
-import com.genexus.json.JSONObjectWrapper;
 
 import java.io.Serializable;
 import java.util.Iterator;
@@ -40,7 +41,7 @@ public GXXMLSerializable(int remoteHandle, ModelContext context, String type)
 	private static final String GET_METHOD_NAME = "getgxTv_";
 	private static final String SET_METHOD_NAME = "setgxTv_";
 	private JSONObjectWrapper jsonObj = new JSONObjectWrapper();
-	private JSONArray jsonArr = new JSONArray();
+	private JSONArrayWrapper jsonArr = new JSONArrayWrapper();
 	protected boolean isArrayObject = false;
 	protected String arrayItemName;
 	protected String type;
@@ -240,7 +241,11 @@ public void AddObjectProperty(String name, Object prop, boolean includeState, bo
 				}
 				else if (isArrayObject)
 				{
-					jsonArr = (JSONArray)((IGxJSONAble)prop).GetJSONObject(includeState);
+					Object obj = ((IGxJSONAble)prop).GetJSONObject(includeState);
+					if (obj instanceof JSONArrayWrapper)
+						jsonArr = (JSONArrayWrapper)obj;
+					else
+						jsonArr = new JSONArrayWrapper((JSONArray)obj);
 				}
 				else
 				{

From 285c0db150eef182eba9792d12ff8b8bf772103d Mon Sep 17 00:00:00 2001
From: iroqueta <iroqueta@genexus.com>
Date: Mon, 24 Jun 2024 11:18:00 -0300
Subject: [PATCH 21/24] Remove org.json lib fork and use new version of the API
 https://github.com/stleary/JSON-java Issue: 105607

---
 common/src/main/java/com/genexus/xml/GXXMLSerializable.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/src/main/java/com/genexus/xml/GXXMLSerializable.java b/common/src/main/java/com/genexus/xml/GXXMLSerializable.java
index 3f7a4c425..681775600 100644
--- a/common/src/main/java/com/genexus/xml/GXXMLSerializable.java
+++ b/common/src/main/java/com/genexus/xml/GXXMLSerializable.java
@@ -476,7 +476,7 @@ private void collectionFromJSONArray(JSONArray jsonArray, GXSimpleCollection gxC
                     else
                     {
 						if (gxColl.getElementsType() == java.math.BigDecimal.class)
-							gxColl.addBase(DecimalUtil.stringToDec(jsonArray.getString(i)));
+							gxColl.addBase(DecimalUtil.stringToDec(jsonArray.get(i).toString()));
 						else
                         	gxColl.addBase(currObj);
                     }

From 48b1f684b56b147f133f84b4fc3a230e6ffcf6d7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Juan=20Pablo=20Gonz=C3=A1lez?= <jpgonzab@gmail.com>
Date: Wed, 26 Jun 2024 10:52:03 -0300
Subject: [PATCH 22/24] Fix SDTs instantiation not working in offline Android
 procedures

---
 .../android/AndroidJSONSerialization.java     | 21 +++++++++++++++++++
 .../com/genexus/specific/android/Connect.java |  1 +
 .../IExtensionJSONSerialization.java          | 10 +++++++++
 .../interfaces/SpecificImplementation.java    |  1 +
 .../com/genexus/xml/GXXMLSerializable.java    | 17 ++++++++++++---
 5 files changed, 47 insertions(+), 3 deletions(-)
 create mode 100644 android/src/main/java/com/genexus/specific/android/AndroidJSONSerialization.java
 create mode 100644 common/src/main/java/com/genexus/common/interfaces/IExtensionJSONSerialization.java

diff --git a/android/src/main/java/com/genexus/specific/android/AndroidJSONSerialization.java b/android/src/main/java/com/genexus/specific/android/AndroidJSONSerialization.java
new file mode 100644
index 000000000..d8e43c17d
--- /dev/null
+++ b/android/src/main/java/com/genexus/specific/android/AndroidJSONSerialization.java
@@ -0,0 +1,21 @@
+package com.genexus.specific.android;
+
+import com.genexus.common.interfaces.IExtensionJSONSerialization;
+import com.genexus.json.JSONObjectWrapper;
+
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+public class AndroidJSONSerialization implements IExtensionJSONSerialization {
+	@Override
+	public Iterator<Map.Entry<String, Object>> getJSONObjectIterator(JSONObjectWrapper obj) {
+		Map<String, Object> map = new LinkedHashMap<>();
+		for (Iterator<String> it = obj.keys(); it.hasNext(); ) {
+			String k = it.next();
+			map.put(k, null); // value is not used for now, so we just set it as null
+		}
+
+		return map.entrySet().iterator();
+	}
+}
diff --git a/android/src/main/java/com/genexus/specific/android/Connect.java b/android/src/main/java/com/genexus/specific/android/Connect.java
index e8c8060e8..462a7e6c7 100644
--- a/android/src/main/java/com/genexus/specific/android/Connect.java
+++ b/android/src/main/java/com/genexus/specific/android/Connect.java
@@ -32,6 +32,7 @@ public static void init()
 		// connect GXSilentTrn
 		SpecificImplementation.GXSilentTrnSdt = new GXSilentTrnSdt();
 		SpecificImplementation.SdtMessages_Message = new SdtMessages_Message();
+		SpecificImplementation.JsonSerialization = new AndroidJSONSerialization();
 
 		SpecificImplementation.KeepDecimals = true;
 		SpecificImplementation.MillisecondMask = "SSS";
diff --git a/common/src/main/java/com/genexus/common/interfaces/IExtensionJSONSerialization.java b/common/src/main/java/com/genexus/common/interfaces/IExtensionJSONSerialization.java
new file mode 100644
index 000000000..060f64d62
--- /dev/null
+++ b/common/src/main/java/com/genexus/common/interfaces/IExtensionJSONSerialization.java
@@ -0,0 +1,10 @@
+package com.genexus.common.interfaces;
+
+import com.genexus.json.JSONObjectWrapper;
+
+import java.util.Iterator;
+import java.util.Map;
+
+public interface IExtensionJSONSerialization {
+	Iterator<Map.Entry<String, Object>> getJSONObjectIterator(JSONObjectWrapper obj);
+}
diff --git a/common/src/main/java/com/genexus/common/interfaces/SpecificImplementation.java b/common/src/main/java/com/genexus/common/interfaces/SpecificImplementation.java
index 7a04fd425..2f23af3ff 100644
--- a/common/src/main/java/com/genexus/common/interfaces/SpecificImplementation.java
+++ b/common/src/main/java/com/genexus/common/interfaces/SpecificImplementation.java
@@ -27,6 +27,7 @@ public class SpecificImplementation {
 	public static IExtensionHTTPConnection					HTTPConnection;
 	public static ICryptoAlhorithms 						Algorithms;
 	public static IExtensionModelContext					ModelContext;
+	public static IExtensionJSONSerialization				JsonSerialization;
 	public static boolean KeepDecimals;
 	public static String MillisecondMask;
 	public static boolean SupportPending;
diff --git a/common/src/main/java/com/genexus/xml/GXXMLSerializable.java b/common/src/main/java/com/genexus/xml/GXXMLSerializable.java
index 681775600..e6d8cf4ee 100644
--- a/common/src/main/java/com/genexus/xml/GXXMLSerializable.java
+++ b/common/src/main/java/com/genexus/xml/GXXMLSerializable.java
@@ -304,6 +304,8 @@ private Iterator getFromJSONObjectOrderIterator(Iterator<Map.Entry<String, Objec
 		String name;
         while(it.hasNext())
         {
+			/* Even though the map entry value is never used and the method could receive just the map's keys list,
+				its entries set provides the keys in a specific order required by this method */
 			Map.Entry<String, Object> entry = it.next();
         	name = entry.getKey();
 	        String map = getJsonMap(name);
@@ -363,10 +365,11 @@ public void FromJSONObject(Object obj)
 		{
 			if (obj instanceof JSONObject)
 				obj = new JSONObjectWrapper((JSONObject)obj);
-			Iterator it = getFromJSONObjectOrderIterator(((JSONObjectWrapper)obj).entrySet().iterator());
-			while(it.hasNext())
+			Iterator unorderedIterator = getJSONObjectIterator((JSONObjectWrapper) obj);
+			Iterator orderedIterator = getFromJSONObjectOrderIterator(unorderedIterator);
+			while(orderedIterator.hasNext())
 			{
-				name = (String)it.next();
+				name = (String)orderedIterator.next();
 				map = getJsonMap(name);
 				setMethod = getMethod(SET_METHOD_NAME + className + "_" + (map != null? map : name));
 				getMethod = getMethod(GET_METHOD_NAME + className + "_" + (map != null? map : name));
@@ -433,6 +436,14 @@ else if (!currObj.equals(""))
 			}
 		}
 	}
+
+	private Iterator<Map.Entry<String, Object>> getJSONObjectIterator(JSONObjectWrapper obj) {
+		if (SpecificImplementation.JsonSerialization == null)
+			return obj.entrySet().iterator();
+
+		return SpecificImplementation.JsonSerialization.getJSONObjectIterator(obj);
+	}
+
         private Object convertValueToParmType(Object value, Class parmClass) throws Exception
         {
             if (parmClass.getName().equals("java.util.Date"))

From a2f506e30e69cd160ef7f95e4d8a7c29cd1e09a2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Juan=20Pablo=20Gonz=C3=A1lez?= <jpgonzab@gmail.com>
Date: Wed, 26 Jun 2024 12:24:35 -0300
Subject: [PATCH 23/24] Rename Iterator variables

---
 .../src/main/java/com/genexus/xml/GXXMLSerializable.java  | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/common/src/main/java/com/genexus/xml/GXXMLSerializable.java b/common/src/main/java/com/genexus/xml/GXXMLSerializable.java
index e6d8cf4ee..bce82706e 100644
--- a/common/src/main/java/com/genexus/xml/GXXMLSerializable.java
+++ b/common/src/main/java/com/genexus/xml/GXXMLSerializable.java
@@ -365,11 +365,11 @@ public void FromJSONObject(Object obj)
 		{
 			if (obj instanceof JSONObject)
 				obj = new JSONObjectWrapper((JSONObject)obj);
-			Iterator unorderedIterator = getJSONObjectIterator((JSONObjectWrapper) obj);
-			Iterator orderedIterator = getFromJSONObjectOrderIterator(unorderedIterator);
-			while(orderedIterator.hasNext())
+			Iterator objIterator = getJSONObjectIterator((JSONObjectWrapper) obj);
+			Iterator modifiedObjIterator = getFromJSONObjectOrderIterator(objIterator);
+			while(modifiedObjIterator.hasNext())
 			{
-				name = (String)orderedIterator.next();
+				name = (String)modifiedObjIterator.next();
 				map = getJsonMap(name);
 				setMethod = getMethod(SET_METHOD_NAME + className + "_" + (map != null? map : name));
 				getMethod = getMethod(GET_METHOD_NAME + className + "_" + (map != null? map : name));

From 4c4ee08032fd7f441170807e16bb256eccbdcad6 Mon Sep 17 00:00:00 2001
From: iroqueta <iroqueta@genexus.com>
Date: Tue, 23 Jul 2024 17:36:23 -0300
Subject: [PATCH 24/24] Remove org.json lib fork and use new version of the API
 https://github.com/steary/JSON-java

---
 .../src/main/java/com/genexus/internet/HttpAjaxContext.java  | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gxweb/src/main/java/com/genexus/internet/HttpAjaxContext.java b/gxweb/src/main/java/com/genexus/internet/HttpAjaxContext.java
index 3a09a5312..70513ace1 100644
--- a/gxweb/src/main/java/com/genexus/internet/HttpAjaxContext.java
+++ b/gxweb/src/main/java/com/genexus/internet/HttpAjaxContext.java
@@ -1197,6 +1197,11 @@ else if (parm.getClass().isArray())
 					}
 					else
 					{
+						if (parm instanceof Date) {
+							LocalUtil localUtil = Application.getClientLocalUtil();
+							inputs.put(localUtil.format((Date)parm, localUtil.getDateFormat() + " " + localUtil.getTimeFormat()));
+						}
+						else
 							inputs.put(parm);
 					}
 			}
