asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ima...@apache.org
Subject [3/6] asterixdb git commit: ASTERIXDB-1714: Eliminate dependency on org.json
Date Fri, 06 Jan 2017 11:43:22 GMT
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d49bc6eb/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/APoint.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/APoint.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/APoint.java
index c1de289..a847cff 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/APoint.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/APoint.java
@@ -18,8 +18,8 @@
  */
 package org.apache.asterix.om.base;
 
-import org.json.JSONException;
-import org.json.JSONObject;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 
 import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.om.types.BuiltinType;
@@ -75,13 +75,13 @@ public class APoint implements IAObject {
     }
 
     @Override
-    public JSONObject toJSON() throws JSONException {
-        JSONObject json = new JSONObject();
-
-        JSONObject point = new JSONObject();
+    public ObjectNode toJSON()  {
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode json = om.createObjectNode();
+        ObjectNode point = om.createObjectNode();
         point.put("x", x);
         point.put("y", y);
-        json.put("APoint", point);
+        json.set("APoint", point);
 
         return json;
     }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d49bc6eb/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/APoint3D.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/APoint3D.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/APoint3D.java
index 28b29e7..7b8ad94 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/APoint3D.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/APoint3D.java
@@ -18,8 +18,8 @@
  */
 package org.apache.asterix.om.base;
 
-import org.json.JSONException;
-import org.json.JSONObject;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 
 import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.om.types.BuiltinType;
@@ -81,14 +81,15 @@ public class APoint3D implements IAObject {
     }
 
     @Override
-    public JSONObject toJSON() throws JSONException {
-        JSONObject json = new JSONObject();
+    public ObjectNode toJSON()  {
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode json = om.createObjectNode();
 
-        JSONObject point = new JSONObject();
+        ObjectNode point = om.createObjectNode();
         point.put("x", x);
         point.put("y", y);
         point.put("z", z);
-        json.put("APoint3D", point);
+        json.set("APoint3D", point);
 
         return json;
     }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d49bc6eb/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/APolygon.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/APolygon.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/APolygon.java
index 142c4a0..7a3a167 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/APolygon.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/APolygon.java
@@ -18,9 +18,9 @@
  */
 package org.apache.asterix.om.base;
 
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 
 import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.om.types.BuiltinType;
@@ -95,14 +95,15 @@ public class APolygon implements IAObject {
     }
 
     @Override
-    public JSONObject toJSON() throws JSONException {
-        JSONObject json = new JSONObject();
+    public ObjectNode toJSON()  {
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode json = om.createObjectNode();
 
-        JSONArray polygon = new JSONArray();
+        ArrayNode polygon = om.createArrayNode();
         for (int i = 0; i < points.length; i++) {
-            polygon.put(points[i].toJSON());
+            polygon.add(points[i].toJSON());
         }
-        json.put("APolygon", polygon);
+        json.set("APolygon", polygon);
 
         return json;
     }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d49bc6eb/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ARecord.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ARecord.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ARecord.java
index c35f000..cda4d2b 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ARecord.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ARecord.java
@@ -18,12 +18,13 @@
  */
 package org.apache.asterix.om.base;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
 import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.om.types.ARecordType;
 import org.apache.asterix.om.visitors.IOMVisitor;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+
+import com.fasterxml.jackson.databind.node.ObjectNode;
 
 public class ARecord implements IAObject {
     public static final ARecord EMPTY_OPEN_RECORD = new ARecord(ARecordType.FULLY_OPEN_RECORD_TYPE, new IAObject[] {});
@@ -104,16 +105,17 @@ public class ARecord implements IAObject {
     }
 
     @Override
-    public JSONObject toJSON() throws JSONException {
-        JSONObject json = new JSONObject();
+    public ObjectNode toJSON()  {
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode json = om.createObjectNode();
 
-        JSONArray record = new JSONArray();
+        ArrayNode record = om.createArrayNode();
         for (int i = 0; i < fields.length; i++) {
-            JSONObject item = new JSONObject();
-            item.put(type.getFieldNames()[i], fields[i]);
-            record.put(item);
+            ObjectNode item = om.createObjectNode();
+            item.set(type.getFieldNames()[i], fields[i].toJSON());
+            record.add(item);
         }
-        json.put("ARecord", record);
+        json.set("ARecord", record);
 
         return json;
     }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d49bc6eb/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ARectangle.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ARectangle.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ARectangle.java
index 2bb780a..4bff3a8 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ARectangle.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ARectangle.java
@@ -18,8 +18,8 @@
  */
 package org.apache.asterix.om.base;
 
-import org.json.JSONException;
-import org.json.JSONObject;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 
 import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.om.types.BuiltinType;
@@ -75,13 +75,14 @@ public class ARectangle implements IAObject {
     }
 
     @Override
-    public JSONObject toJSON() throws JSONException {
-        JSONObject json = new JSONObject();
+    public ObjectNode toJSON()  {
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode json = om.createObjectNode();
 
-        JSONObject rectangle = new JSONObject();
-        rectangle.put("p1", p1);
-        rectangle.put("p2", p2);
-        json.put("ARectangle", rectangle);
+        ObjectNode rectangle = om.createObjectNode();
+        rectangle.set("p1", p1.toJSON());
+        rectangle.set("p2", p2.toJSON());
+        json.set("ARectangle", rectangle);
 
         return json;
     }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d49bc6eb/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/AString.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/AString.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/AString.java
index a1a89fe..b0cedbc 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/AString.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/AString.java
@@ -20,12 +20,13 @@ package org.apache.asterix.om.base;
 
 import java.io.Serializable;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
 import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.om.types.BuiltinType;
 import org.apache.asterix.om.types.IAType;
 import org.apache.asterix.om.visitors.IOMVisitor;
-import org.json.JSONException;
-import org.json.JSONObject;
+
+import com.fasterxml.jackson.databind.node.ObjectNode;
 
 public class AString implements IAObject, Serializable {
 
@@ -78,8 +79,9 @@ public class AString implements IAObject, Serializable {
     }
 
     @Override
-    public JSONObject toJSON() throws JSONException {
-        JSONObject json = new JSONObject();
+    public ObjectNode toJSON()  {
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode json = om.createObjectNode();
 
         json.put("AString", value);
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d49bc6eb/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ATime.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ATime.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ATime.java
index 7cc303e..2a9e6da 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ATime.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ATime.java
@@ -20,8 +20,8 @@ package org.apache.asterix.om.base;
 
 import java.io.IOException;
 
-import org.json.JSONException;
-import org.json.JSONObject;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 
 import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.om.base.temporal.GregorianCalendarSystem;
@@ -112,8 +112,9 @@ public class ATime implements IAObject {
     }
 
     @Override
-    public JSONObject toJSON() throws JSONException {
-        JSONObject json = new JSONObject();
+    public ObjectNode toJSON()  {
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode json = om.createObjectNode();
 
         json.put("ATime", chrononTime);
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d49bc6eb/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/AUUID.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/AUUID.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/AUUID.java
index 025866c..2c7f531 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/AUUID.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/AUUID.java
@@ -24,13 +24,13 @@ import java.io.DataOutput;
 import java.io.IOException;
 import java.util.Arrays;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
 import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.om.types.BuiltinType;
 import org.apache.asterix.om.types.IAType;
 import org.apache.asterix.om.visitors.IOMVisitor;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.json.JSONException;
-import org.json.JSONObject;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 
 public class AUUID implements IAObject {
 
@@ -57,8 +57,9 @@ public class AUUID implements IAObject {
     }
 
     @Override
-    public JSONObject toJSON() throws JSONException {
-        JSONObject json = new JSONObject();
+    public ObjectNode toJSON()  {
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode json = om.createObjectNode();
         json.put("AUUID", toString());
         return json;
     }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d49bc6eb/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/AUnorderedList.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/AUnorderedList.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/AUnorderedList.java
index 8f19b7e..62043f2 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/AUnorderedList.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/AUnorderedList.java
@@ -21,13 +21,13 @@ package org.apache.asterix.om.base;
 import java.util.ArrayList;
 import java.util.List;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
 import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.om.types.AUnorderedListType;
 import org.apache.asterix.om.types.IAType;
 import org.apache.asterix.om.visitors.IOMVisitor;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 
 public class AUnorderedList implements IACollection {
 
@@ -117,14 +117,15 @@ public class AUnorderedList implements IACollection {
     }
 
     @Override
-    public JSONObject toJSON() throws JSONException {
-        JSONObject json = new JSONObject();
+    public ObjectNode toJSON()  {
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode json = om.createObjectNode();
 
-        JSONArray list = new JSONArray();
+        ArrayNode list = om.createArrayNode();
         for (IAObject v : values) {
-            list.put(v.toJSON());
+            list.add(v.toJSON());
         }
-        json.put("AUnorderedList", list);
+        json.set("AUnorderedList", list);
 
         return json;
     }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d49bc6eb/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/AYearMonthDuration.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/AYearMonthDuration.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/AYearMonthDuration.java
index 8fd21dc..ce8e7c5 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/AYearMonthDuration.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/AYearMonthDuration.java
@@ -18,8 +18,9 @@
  */
 package org.apache.asterix.om.base;
 
-import org.json.JSONException;
-import org.json.JSONObject;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import com.fasterxml.jackson.databind.node.ObjectNode;
 
 import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.om.types.BuiltinType;
@@ -50,12 +51,13 @@ public class AYearMonthDuration implements IAObject {
      * @see org.apache.hyracks.api.dataflow.value.JSONSerializable#toJSON()
      */
     @Override
-    public JSONObject toJSON() throws JSONException {
-        JSONObject json = new JSONObject();
+    public ObjectNode toJSON()  {
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode json = om.createObjectNode();
 
-        JSONObject duration = new JSONObject();
+        ObjectNode duration = om.createObjectNode();
         duration.put("months", chrononInMonth);
-        json.put("ADuration", duration);
+        json.set("ADuration", duration);
 
         return json;
     }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d49bc6eb/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ShortWithoutTypeInfo.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ShortWithoutTypeInfo.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ShortWithoutTypeInfo.java
index e1206ac..b600995 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ShortWithoutTypeInfo.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ShortWithoutTypeInfo.java
@@ -18,8 +18,8 @@
  */
 package org.apache.asterix.om.base;
 
-import org.json.JSONException;
-import org.json.JSONObject;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 
 import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.om.types.BuiltinType;
@@ -91,8 +91,9 @@ public class ShortWithoutTypeInfo implements IAObject {
     }
 
     @Override
-    public JSONObject toJSON() throws JSONException {
-        JSONObject json = new JSONObject();
+    public ObjectNode toJSON()  {
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode json = om.createObjectNode();
 
         json.put("ShortWithoutTypeInfo", value);
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d49bc6eb/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/AOrderedListType.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/AOrderedListType.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/AOrderedListType.java
index d523124..9f7f360 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/AOrderedListType.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/AOrderedListType.java
@@ -18,9 +18,9 @@
  */
 package org.apache.asterix.om.types;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
 import org.apache.asterix.om.base.IAObject;
-import org.json.JSONException;
-import org.json.JSONObject;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 
 public class AOrderedListType extends AbstractCollectionType {
 
@@ -76,10 +76,11 @@ public class AOrderedListType extends AbstractCollectionType {
     }
 
     @Override
-    public JSONObject toJSON() throws JSONException {
-        JSONObject type = new JSONObject();
+    public ObjectNode toJSON()  {
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode type = om.createObjectNode();
         type.put("type", AOrderedListType.class.getName());
-        type.put("item-type", itemType.toJSON());
+        type.set("item-type", itemType.toJSON());
         return type;
     }
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d49bc6eb/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/ARecordType.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/ARecordType.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/ARecordType.java
index fc1108f..4ce1a6d 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/ARecordType.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/ARecordType.java
@@ -26,15 +26,15 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
 import org.apache.asterix.common.annotations.IRecordTypeAnnotation;
 import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.om.base.IAObject;
 import org.apache.asterix.om.util.NonTaggedFormatUtil;
 import org.apache.asterix.om.visitors.IOMVisitor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 
 /**
  * ARecordType is read-only and shared by different partitions at runtime.
@@ -327,8 +327,9 @@ public class ARecordType extends AbstractComplexType {
     }
 
     @Override
-    public JSONObject toJSON() throws JSONException {
-        JSONObject type = new JSONObject();
+    public ObjectNode toJSON()  {
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode type = om.createObjectNode();
         type.put("type", ARecordType.class.getName());
         type.put("name", typeName);
         if (isOpen) {
@@ -337,14 +338,14 @@ public class ARecordType extends AbstractComplexType {
             type.put("open", false);
         }
 
-        JSONArray fields = new JSONArray();
+        ArrayNode fields = om.createArrayNode();
         for (int i = 0; i < fieldNames.length; i++) {
-            JSONObject field = new JSONObject();
-            field.put(fieldNames[i], fieldTypes[i].toJSON());
-            fields.put(field);
+            ObjectNode field = om.createObjectNode();
+            field.set(fieldNames[i], fieldTypes[i].toJSON());
+            fields.add(field);
         }
 
-        type.put("fields", fields);
+        type.set("fields", fields);
         return type;
     }
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d49bc6eb/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/AUnionType.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/AUnionType.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/AUnionType.java
index 9eb2b88..af06108 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/AUnionType.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/AUnionType.java
@@ -22,12 +22,12 @@ import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
 import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.om.base.IAObject;
 import org.apache.asterix.om.visitors.IOMVisitor;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 
 public class AUnionType extends AbstractComplexType {
 
@@ -203,21 +203,22 @@ public class AUnionType extends AbstractComplexType {
     }
 
     @Override
-    public JSONObject toJSON() throws JSONException {
-        JSONObject type = new JSONObject();
+    public ObjectNode toJSON()  {
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode type = om.createObjectNode();
         type.put("type", AUnionType.class.getName());
 
-        JSONArray fields = new JSONArray();
+        ArrayNode fields = om.createArrayNode();
         Iterator<IAType> iter = unionList.iterator();
         if (iter.hasNext()) {
             IAType t0 = iter.next();
-            fields.put(t0.toJSON());
+            fields.add(t0.toJSON());
             while (iter.hasNext()) {
-                fields.put(iter.next().toJSON());
+                fields.add(iter.next().toJSON());
             }
         }
 
-        type.put("fields", fields);
+        type.set("fields", fields);
         return type;
     }
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d49bc6eb/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/AUnorderedListType.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/AUnorderedListType.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/AUnorderedListType.java
index febc6ad..b4705ac 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/AUnorderedListType.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/AUnorderedListType.java
@@ -18,10 +18,10 @@
  */
 package org.apache.asterix.om.types;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
 import org.apache.asterix.om.base.AUnorderedList;
 import org.apache.asterix.om.base.IAObject;
-import org.json.JSONException;
-import org.json.JSONObject;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 
 public class AUnorderedListType extends AbstractCollectionType {
 
@@ -77,10 +77,11 @@ public class AUnorderedListType extends AbstractCollectionType {
     }
 
     @Override
-    public JSONObject toJSON() throws JSONException {
-        JSONObject type = new JSONObject();
+    public ObjectNode toJSON()  {
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode type = om.createObjectNode();
         type.put("type", AUnorderedListType.class.getName());
-        type.put("item-type", itemType.toJSON());
+        type.set("item-type", itemType.toJSON());
         return type;
     }
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d49bc6eb/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/BuiltinType.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/BuiltinType.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/BuiltinType.java
index 809578b..42745f4 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/BuiltinType.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/BuiltinType.java
@@ -18,11 +18,11 @@
  */
 package org.apache.asterix.om.types;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
 import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.om.base.IAObject;
 import org.apache.asterix.om.visitors.IOMVisitor;
-import org.json.JSONException;
-import org.json.JSONObject;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 
 public abstract class BuiltinType implements IAType {
 
@@ -63,8 +63,9 @@ public abstract class BuiltinType implements IAType {
         }
 
         @Override
-        public JSONObject toJSON() throws JSONException {
-            JSONObject type = new JSONObject();
+        public ObjectNode toJSON() {
+            ObjectMapper om = new ObjectMapper();
+            ObjectNode type = om.createObjectNode();
             type.put("type", "ASTERIX_TYPE");
             return type;
         }
@@ -90,8 +91,9 @@ public abstract class BuiltinType implements IAType {
         }
 
         @Override
-        public JSONObject toJSON() throws JSONException {
-            JSONObject type = new JSONObject();
+        public ObjectNode toJSON() {
+            ObjectMapper om = new ObjectMapper();
+            ObjectNode type = om.createObjectNode();
             type.put("type", "AInt8");
             return type;
         }
@@ -117,8 +119,9 @@ public abstract class BuiltinType implements IAType {
         }
 
         @Override
-        public JSONObject toJSON() throws JSONException {
-            JSONObject type = new JSONObject();
+        public ObjectNode toJSON() {
+            ObjectMapper om = new ObjectMapper();
+            ObjectNode type = om.createObjectNode();
             type.put("type", "AInt16");
             return type;
         }
@@ -144,8 +147,9 @@ public abstract class BuiltinType implements IAType {
         }
 
         @Override
-        public JSONObject toJSON() throws JSONException {
-            JSONObject type = new JSONObject();
+        public ObjectNode toJSON() {
+            ObjectMapper om = new ObjectMapper();
+            ObjectNode type = om.createObjectNode();
             type.put("type", "AInt32");
             return type;
         }
@@ -171,8 +175,9 @@ public abstract class BuiltinType implements IAType {
         }
 
         @Override
-        public JSONObject toJSON() throws JSONException {
-            JSONObject type = new JSONObject();
+        public ObjectNode toJSON() {
+            ObjectMapper om = new ObjectMapper();
+            ObjectNode type = om.createObjectNode();
             type.put("type", "AInt64");
             return type;
         }
@@ -198,8 +203,9 @@ public abstract class BuiltinType implements IAType {
         }
 
         @Override
-        public JSONObject toJSON() throws JSONException {
-            JSONObject type = new JSONObject();
+        public ObjectNode toJSON() {
+            ObjectMapper om = new ObjectMapper();
+            ObjectNode type = om.createObjectNode();
             type.put("type", "ABinary");
             return type;
         }
@@ -225,8 +231,9 @@ public abstract class BuiltinType implements IAType {
         }
 
         @Override
-        public JSONObject toJSON() throws JSONException {
-            JSONObject type = new JSONObject();
+        public ObjectNode toJSON() {
+            ObjectMapper om = new ObjectMapper();
+            ObjectNode type = om.createObjectNode();
             type.put("type", "AFloat");
             return type;
         }
@@ -252,8 +259,9 @@ public abstract class BuiltinType implements IAType {
         }
 
         @Override
-        public JSONObject toJSON() throws JSONException {
-            JSONObject type = new JSONObject();
+        public ObjectNode toJSON() {
+            ObjectMapper om = new ObjectMapper();
+            ObjectNode type = om.createObjectNode();
             type.put("type", "ADouble");
             return type;
         }
@@ -279,8 +287,9 @@ public abstract class BuiltinType implements IAType {
         }
 
         @Override
-        public JSONObject toJSON() throws JSONException {
-            JSONObject type = new JSONObject();
+        public ObjectNode toJSON() {
+            ObjectMapper om = new ObjectMapper();
+            ObjectNode type = om.createObjectNode();
             type.put("type", "AString");
             return type;
         }
@@ -306,8 +315,9 @@ public abstract class BuiltinType implements IAType {
         }
 
         @Override
-        public JSONObject toJSON() throws JSONException {
-            JSONObject type = new JSONObject();
+        public ObjectNode toJSON() {
+            ObjectMapper om = new ObjectMapper();
+            ObjectNode type = om.createObjectNode();
             type.put("type", "AMISSING");
             return type;
         }
@@ -333,8 +343,9 @@ public abstract class BuiltinType implements IAType {
         }
 
         @Override
-        public JSONObject toJSON() throws JSONException {
-            JSONObject type = new JSONObject();
+        public ObjectNode toJSON() {
+            ObjectMapper om = new ObjectMapper();
+            ObjectNode type = om.createObjectNode();
             type.put("type", "ANULL");
             return type;
         }
@@ -360,8 +371,9 @@ public abstract class BuiltinType implements IAType {
         }
 
         @Override
-        public JSONObject toJSON() throws JSONException {
-            JSONObject type = new JSONObject();
+        public ObjectNode toJSON() {
+            ObjectMapper om = new ObjectMapper();
+            ObjectNode type = om.createObjectNode();
             type.put("type", "ABoolean");
             return type;
         }
@@ -387,8 +399,9 @@ public abstract class BuiltinType implements IAType {
         }
 
         @Override
-        public JSONObject toJSON() throws JSONException {
-            JSONObject type = new JSONObject();
+        public ObjectNode toJSON() {
+            ObjectMapper om = new ObjectMapper();
+            ObjectNode type = om.createObjectNode();
             type.put("type", "ATime");
             return type;
         }
@@ -414,8 +427,9 @@ public abstract class BuiltinType implements IAType {
         }
 
         @Override
-        public JSONObject toJSON() throws JSONException {
-            JSONObject type = new JSONObject();
+        public ObjectNode toJSON() {
+            ObjectMapper om = new ObjectMapper();
+            ObjectNode type = om.createObjectNode();
             type.put("type", "ADate");
             return type;
         }
@@ -441,8 +455,9 @@ public abstract class BuiltinType implements IAType {
         }
 
         @Override
-        public JSONObject toJSON() throws JSONException {
-            JSONObject type = new JSONObject();
+        public ObjectNode toJSON() {
+            ObjectMapper om = new ObjectMapper();
+            ObjectNode type = om.createObjectNode();
             type.put("type", "ADateTime");
             return type;
         }
@@ -468,8 +483,9 @@ public abstract class BuiltinType implements IAType {
         }
 
         @Override
-        public JSONObject toJSON() throws JSONException {
-            JSONObject type = new JSONObject();
+        public ObjectNode toJSON() {
+            ObjectMapper om = new ObjectMapper();
+            ObjectNode type = om.createObjectNode();
             type.put("type", "ADuration");
             return type;
         }
@@ -495,8 +511,9 @@ public abstract class BuiltinType implements IAType {
         }
 
         @Override
-        public JSONObject toJSON() throws JSONException {
-            JSONObject type = new JSONObject();
+        public ObjectNode toJSON() {
+            ObjectMapper om = new ObjectMapper();
+            ObjectNode type = om.createObjectNode();
             type.put("type", "AYearMonthDuration");
             return type;
         }
@@ -522,8 +539,9 @@ public abstract class BuiltinType implements IAType {
         }
 
         @Override
-        public JSONObject toJSON() throws JSONException {
-            JSONObject type = new JSONObject();
+        public ObjectNode toJSON() {
+            ObjectMapper om = new ObjectMapper();
+            ObjectNode type = om.createObjectNode();
             type.put("type", "ADayTimeDuration");
             return type;
         }
@@ -549,7 +567,7 @@ public abstract class BuiltinType implements IAType {
         }
 
         @Override
-        public JSONObject toJSON() throws JSONException {
+        public ObjectNode toJSON() {
             return null;
         }
     };
@@ -574,8 +592,9 @@ public abstract class BuiltinType implements IAType {
         }
 
         @Override
-        public JSONObject toJSON() throws JSONException {
-            JSONObject type = new JSONObject();
+        public ObjectNode toJSON() {
+            ObjectMapper om = new ObjectMapper();
+            ObjectNode type = om.createObjectNode();
             type.put("type", "APoint");
             return type;
         }
@@ -601,8 +620,9 @@ public abstract class BuiltinType implements IAType {
         }
 
         @Override
-        public JSONObject toJSON() throws JSONException {
-            JSONObject type = new JSONObject();
+        public ObjectNode toJSON() {
+            ObjectMapper om = new ObjectMapper();
+            ObjectNode type = om.createObjectNode();
             type.put("type", "APoint3D");
             return type;
         }
@@ -628,8 +648,9 @@ public abstract class BuiltinType implements IAType {
         }
 
         @Override
-        public JSONObject toJSON() throws JSONException {
-            JSONObject type = new JSONObject();
+        public ObjectNode toJSON() {
+            ObjectMapper om = new ObjectMapper();
+            ObjectNode type = om.createObjectNode();
             type.put("type", "ALINE");
             return type;
         }
@@ -655,8 +676,9 @@ public abstract class BuiltinType implements IAType {
         }
 
         @Override
-        public JSONObject toJSON() throws JSONException {
-            JSONObject type = new JSONObject();
+        public ObjectNode toJSON() {
+            ObjectMapper om = new ObjectMapper();
+            ObjectNode type = om.createObjectNode();
             type.put("type", "APOLYGON");
             return type;
         }
@@ -682,8 +704,9 @@ public abstract class BuiltinType implements IAType {
         }
 
         @Override
-        public JSONObject toJSON() throws JSONException {
-            JSONObject type = new JSONObject();
+        public ObjectNode toJSON() {
+            ObjectMapper om = new ObjectMapper();
+            ObjectNode type = om.createObjectNode();
             type.put("type", "ACIRCLE");
             return type;
         }
@@ -709,8 +732,9 @@ public abstract class BuiltinType implements IAType {
         }
 
         @Override
-        public JSONObject toJSON() throws JSONException {
-            JSONObject type = new JSONObject();
+        public ObjectNode toJSON() {
+            ObjectMapper om = new ObjectMapper();
+            ObjectNode type = om.createObjectNode();
             type.put("type", "ARECTANGLE");
             return type;
         }
@@ -736,8 +760,9 @@ public abstract class BuiltinType implements IAType {
         }
 
         @Override
-        public JSONObject toJSON() throws JSONException {
-            JSONObject type = new JSONObject();
+        public ObjectNode toJSON() {
+            ObjectMapper om = new ObjectMapper();
+            ObjectNode type = om.createObjectNode();
             type.put("type", "ABitArray");
             return type;
         }
@@ -762,8 +787,9 @@ public abstract class BuiltinType implements IAType {
         }
 
         @Override
-        public JSONObject toJSON() throws JSONException {
-            JSONObject type = new JSONObject();
+        public ObjectNode toJSON() {
+            ObjectMapper om = new ObjectMapper();
+            ObjectNode type = om.createObjectNode();
             type.put("type", getDisplayName());
             return type;
         }
@@ -794,8 +820,9 @@ public abstract class BuiltinType implements IAType {
         }
 
         @Override
-        public JSONObject toJSON() throws JSONException {
-            JSONObject type = new JSONObject();
+        public ObjectNode toJSON() {
+            ObjectMapper om = new ObjectMapper();
+            ObjectNode type = om.createObjectNode();
             type.put("type", "ANY");
             return type;
         }
@@ -826,8 +853,9 @@ public abstract class BuiltinType implements IAType {
         }
 
         @Override
-        public JSONObject toJSON() throws JSONException {
-            JSONObject type = new JSONObject();
+        public ObjectNode toJSON() {
+            ObjectMapper om = new ObjectMapper();
+            ObjectNode type = om.createObjectNode();
             type.put("type", "SHORTWITHOUTTYPEINFO");
             return type;
         }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d49bc6eb/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/util/JSONDeserializerForTypes.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/util/JSONDeserializerForTypes.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/util/JSONDeserializerForTypes.java
index b646ea1..8e8993a 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/util/JSONDeserializerForTypes.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/util/JSONDeserializerForTypes.java
@@ -23,9 +23,11 @@ import java.lang.reflect.Field;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.json.JSONArray;
-import org.json.JSONObject;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 
+import com.google.common.collect.Lists;
 import org.apache.asterix.om.types.AOrderedListType;
 import org.apache.asterix.om.types.ARecordType;
 import org.apache.asterix.om.types.AUnionType;
@@ -43,26 +45,26 @@ public class JSONDeserializerForTypes {
      * @return an valid AsterixDB type.
      * @throws Exception
      */
-    public static IAType convertFromJSON(JSONObject typeInJSON) throws Exception {
-        String typeName = typeInJSON.getString("type");
+    public static IAType convertFromJSON(JsonNode typeInJSON) throws Exception {
+        String typeName = typeInJSON.get("type").asText();
         // Deals with ordered list.
         if (typeName.equals(AOrderedListType.class.getName())) {
-            IAType itemType = convertFromJSON((JSONObject) typeInJSON.get("item-type"));
+            IAType itemType = convertFromJSON(typeInJSON.get("item-type"));
             return new AOrderedListType(itemType, "ordered-list");
         }
 
         // Deals with unordered list.
         if (typeName.equals(AUnorderedListType.class.getName())) {
-            IAType itemType = convertFromJSON((JSONObject) typeInJSON.get("item-type"));
+            IAType itemType = convertFromJSON(typeInJSON.get("item-type"));
             return new AUnorderedListType(itemType, "unordered-list");
         }
 
         // Deals with Union Type.
         if (typeName.equals(AUnionType.class.getName())) {
             List<IAType> unionTypes = new ArrayList<IAType>();
-            JSONArray fields = (JSONArray) typeInJSON.get("fields");
-            for (int i = 0; i < fields.length(); i++) {
-                JSONObject fieldType = (JSONObject) fields.get(i);
+            JsonNode fields = typeInJSON.get("fields");
+            for (int i = 0; i < fields.size(); i++) {
+                JsonNode fieldType = fields.get(i);
                 unionTypes.add(convertFromJSON(fieldType));
             }
             return new AUnionType(unionTypes, "union");
@@ -70,17 +72,17 @@ public class JSONDeserializerForTypes {
 
         // Deals with record types.
         if (typeName.equals(ARecordType.class.getName())) {
-            String name = typeInJSON.getString("name");
-            boolean openType = typeInJSON.getBoolean("open");
-            JSONArray fields = typeInJSON.getJSONArray("fields");
-            String[] fieldNames = new String[fields.length()];
-            IAType[] fieldTypes = new IAType[fields.length()];
-            for (int i = 0; i < fields.length(); ++i) {
-                JSONObject field = (JSONObject) fields.get(i);
-                JSONArray names = field.names();
-                String fieldName = names.getString(0);
+            String name = typeInJSON.get("name").asText();
+            boolean openType = typeInJSON.get("open").asBoolean();
+            JsonNode fields = typeInJSON.get("fields");
+            String[] fieldNames = new String[fields.size()];
+            IAType[] fieldTypes = new IAType[fields.size()];
+            for (int i = 0; i < fields.size(); ++i) {
+                JsonNode field = fields.get(i);
+                List<String> names = Lists.newArrayList(field.fieldNames());
+                String fieldName = names.get(0);
                 fieldNames[i] = fieldName;
-                fieldTypes[i] = convertFromJSON((JSONObject) field.get(fieldName));
+                fieldTypes[i] = convertFromJSON(field.get(fieldName));
             }
             return new ARecordType(name, fieldNames, fieldTypes, openType);
         }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d49bc6eb/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/util/ClusterStateManager.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/util/ClusterStateManager.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/util/ClusterStateManager.java
index 3ba1965..c79524a 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/util/ClusterStateManager.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/util/ClusterStateManager.java
@@ -31,6 +31,8 @@ import java.util.SortedMap;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ArrayNode;
 import org.apache.asterix.common.api.IClusterManagementWork.ClusterState;
 import org.apache.asterix.common.cluster.ClusterPartition;
 import org.apache.asterix.common.config.ReplicationProperties;
@@ -53,8 +55,8 @@ import org.apache.hyracks.algebricks.common.constraints.AlgebricksAbsolutePartit
 import org.apache.hyracks.api.application.IClusterLifecycleListener.ClusterEventType;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.api.exceptions.HyracksException;
-import org.json.JSONException;
-import org.json.JSONObject;
+
+import com.fasterxml.jackson.databind.node.ObjectNode;
 
 /**
  * A holder class for properties related to the Asterix cluster.
@@ -633,12 +635,15 @@ public class ClusterStateManager {
         return metadataNodeActive;
     }
 
-    public synchronized JSONObject getClusterStateDescription() throws JSONException {
-        JSONObject stateDescription = new JSONObject();
+    public synchronized ObjectNode getClusterStateDescription()  {
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode stateDescription = om.createObjectNode();
         stateDescription.put("state", state.name());
         stateDescription.put("metadata_node", currentMetadataNode);
+        ArrayNode ncs = om.createArrayNode();
+        stateDescription.set("ncs",ncs);
         for (Map.Entry<String, ClusterPartition[]> entry : node2PartitionsMap.entrySet()) {
-            JSONObject nodeJSON = new JSONObject();
+            ObjectNode nodeJSON = om.createObjectNode();
             nodeJSON.put("node_id", entry.getKey());
             boolean allActive = true;
             boolean anyActive = false;
@@ -657,17 +662,18 @@ public class ClusterStateManager {
                     : allActive ? "ACTIVE"
                     : anyActive ? "PARTIALLY_ACTIVE"
                     : "INACTIVE");
-            nodeJSON.put("partitions", partitions);
-            stateDescription.accumulate("ncs", nodeJSON);
+            nodeJSON.putPOJO("partitions", partitions);
+            ncs.add(nodeJSON);
         }
         return stateDescription;
     }
 
-    public synchronized JSONObject getClusterStateSummary() throws JSONException {
-        JSONObject stateDescription = new JSONObject();
+    public synchronized ObjectNode getClusterStateSummary() {
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode stateDescription = om.createObjectNode();
         stateDescription.put("state", state.name());
-        stateDescription.put("metadata_node", currentMetadataNode);
-        stateDescription.put("partitions", clusterPartitions);
+        stateDescription.putPOJO("metadata_node", currentMetadataNode);
+        stateDescription.putPOJO("partitions", clusterPartitions);
         return stateDescription;
     }
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d49bc6eb/asterixdb/pom.xml
----------------------------------------------------------------------
diff --git a/asterixdb/pom.xml b/asterixdb/pom.xml
index ee5067d..675d549 100644
--- a/asterixdb/pom.xml
+++ b/asterixdb/pom.xml
@@ -68,7 +68,6 @@
     <junit.version>4.12</junit.version>
     <commons.io.version>2.5</commons.io.version>
     <servlet.api.version>3.1.0</servlet.api.version>
-    <json.version>20090211</json.version>
     <jacoco.version>0.7.6.201602180812</jacoco.version>
   </properties>
 
@@ -809,12 +808,6 @@
         <type>test-jar</type>
       </dependency>
       <dependency>
-        <groupId>org.json</groupId>
-        <artifactId>json</artifactId>
-        <version>${json.version}</version>
-        <type>jar</type>
-      </dependency>
-      <dependency>
         <groupId>javax.servlet</groupId>
         <artifactId>javax.servlet-api</artifactId>
         <version>${servlet.api.version}</version>
@@ -845,6 +838,16 @@
         <artifactId>httpcore</artifactId>
         <version>4.4</version>
       </dependency>
+      <dependency>
+        <groupId>com.fasterxml.jackson.core</groupId>
+        <artifactId>jackson-databind</artifactId>
+        <version>2.8.4</version>
+      </dependency>
+      <dependency>
+        <groupId>com.fasterxml.jackson.core</groupId>
+        <artifactId>jackson-core</artifactId>
+        <version>2.8.4</version>
+      </dependency>
     </dependencies>
   </dependencyManagement>
 </project>

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d49bc6eb/hyracks-fullstack/algebricks/algebricks-runtime/pom.xml
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/algebricks/algebricks-runtime/pom.xml b/hyracks-fullstack/algebricks/algebricks-runtime/pom.xml
index 17dd1ea..3bd1316 100644
--- a/hyracks-fullstack/algebricks/algebricks-runtime/pom.xml
+++ b/hyracks-fullstack/algebricks/algebricks-runtime/pom.xml
@@ -68,14 +68,13 @@
       <version>${project.version}</version>
     </dependency>
     <dependency>
-      <groupId>org.json</groupId>
-      <artifactId>json</artifactId>
-      <version>20090211</version>
-    </dependency>
-    <dependency>
       <groupId>org.apache.hyracks</groupId>
       <artifactId>hyracks-data-std</artifactId>
       <version>${project.version}</version>
     </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-databind</artifactId>
+    </dependency>
   </dependencies>
 </project>

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d49bc6eb/hyracks-fullstack/algebricks/algebricks-runtime/src/main/java/org/apache/hyracks/algebricks/runtime/operators/meta/AlgebricksMetaOperatorDescriptor.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/algebricks/algebricks-runtime/src/main/java/org/apache/hyracks/algebricks/runtime/operators/meta/AlgebricksMetaOperatorDescriptor.java b/hyracks-fullstack/algebricks/algebricks-runtime/src/main/java/org/apache/hyracks/algebricks/runtime/operators/meta/AlgebricksMetaOperatorDescriptor.java
index 0b7cb7e..1123c5e 100644
--- a/hyracks-fullstack/algebricks/algebricks-runtime/src/main/java/org/apache/hyracks/algebricks/runtime/operators/meta/AlgebricksMetaOperatorDescriptor.java
+++ b/hyracks-fullstack/algebricks/algebricks-runtime/src/main/java/org/apache/hyracks/algebricks/runtime/operators/meta/AlgebricksMetaOperatorDescriptor.java
@@ -19,7 +19,10 @@
 package org.apache.hyracks.algebricks.runtime.operators.meta;
 
 import java.nio.ByteBuffer;
+import java.util.Arrays;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 import org.apache.hyracks.algebricks.runtime.base.AlgebricksPipeline;
 import org.apache.hyracks.algebricks.runtime.base.IPushRuntimeFactory;
 import org.apache.hyracks.api.comm.IFrameWriter;
@@ -32,8 +35,6 @@ import org.apache.hyracks.api.job.IOperatorDescriptorRegistry;
 import org.apache.hyracks.dataflow.std.base.AbstractSingleActivityOperatorDescriptor;
 import org.apache.hyracks.dataflow.std.base.AbstractUnaryInputUnaryOutputOperatorNodePushable;
 import org.apache.hyracks.dataflow.std.base.AbstractUnaryOutputSourceOperatorNodePushable;
-import org.json.JSONException;
-import org.json.JSONObject;
 
 public class AlgebricksMetaOperatorDescriptor extends AbstractSingleActivityOperatorDescriptor {
 
@@ -56,9 +57,9 @@ public class AlgebricksMetaOperatorDescriptor extends AbstractSingleActivityOper
     }
 
     @Override
-    public JSONObject toJSON() throws JSONException {
-        JSONObject json = super.toJSON();
-        json.put("micro-operators", pipeline.getRuntimeFactories());
+    public ObjectNode toJSON() {
+        ObjectNode json = super.toJSON();
+        json.put("micro-operators", Arrays.toString(pipeline.getRuntimeFactories()));
         return json;
     }
 
@@ -70,10 +71,6 @@ public class AlgebricksMetaOperatorDescriptor extends AbstractSingleActivityOper
             sb.append("  " + f.toString() + ";\n");
         }
         sb.append("}");
-        // sb.append(super.getInputArity());
-        // sb.append(";");
-        // sb.append(super.getOutputArity());
-        // sb.append(";");
         return sb.toString();
     }
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d49bc6eb/hyracks-fullstack/algebricks/algebricks-tests/pom.xml
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/algebricks/algebricks-tests/pom.xml b/hyracks-fullstack/algebricks/algebricks-tests/pom.xml
index f49189d..7c42c75 100644
--- a/hyracks-fullstack/algebricks/algebricks-tests/pom.xml
+++ b/hyracks-fullstack/algebricks/algebricks-tests/pom.xml
@@ -154,16 +154,15 @@
       <version>${project.version}</version>
     </dependency>
     <dependency>
-      <groupId>org.json</groupId>
-      <artifactId>json</artifactId>
-      <version>20090211</version>
-    </dependency>
-    <dependency>
       <groupId>org.apache.hyracks</groupId>
       <artifactId>hyracks-dataflow-std</artifactId>
       <version>${project.version}</version>
     </dependency>
     <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-databind</artifactId>
+    </dependency>
+    <dependency>
       <groupId>commons-io</groupId>
       <artifactId>commons-io</artifactId>
     </dependency>

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d49bc6eb/hyracks-fullstack/hyracks/hyracks-api/pom.xml
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-api/pom.xml b/hyracks-fullstack/hyracks/hyracks-api/pom.xml
index e624be6..c872bea 100644
--- a/hyracks-fullstack/hyracks/hyracks-api/pom.xml
+++ b/hyracks-fullstack/hyracks/hyracks-api/pom.xml
@@ -58,13 +58,6 @@
   </build>
   <dependencies>
     <dependency>
-      <groupId>org.json</groupId>
-      <artifactId>json</artifactId>
-      <version>20090211</version>
-      <type>jar</type>
-      <scope>compile</scope>
-    </dependency>
-    <dependency>
       <groupId>org.apache.httpcomponents</groupId>
       <artifactId>httpclient</artifactId>
       <version>4.5.2</version>
@@ -97,5 +90,10 @@
       <version>2.0.2-beta</version>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-databind</artifactId>
+      <version>2.8.1</version>
+    </dependency>
   </dependencies>
 </project>

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d49bc6eb/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/client/impl/ActivityClusterGraphBuilder.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/client/impl/ActivityClusterGraphBuilder.java b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/client/impl/ActivityClusterGraphBuilder.java
index 9a2a658..7dd5fe9 100644
--- a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/client/impl/ActivityClusterGraphBuilder.java
+++ b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/client/impl/ActivityClusterGraphBuilder.java
@@ -28,7 +28,6 @@ import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import org.apache.commons.lang3.tuple.Pair;
-import org.json.JSONException;
 
 import org.apache.hyracks.api.dataflow.ActivityId;
 import org.apache.hyracks.api.dataflow.IActivity;
@@ -150,12 +149,7 @@ public class ActivityClusterGraphBuilder {
         acg.addActivityClusters(acList);
 
         if (LOGGER.isLoggable(Level.FINE)) {
-            try {
-                LOGGER.fine(acg.toJSON().toString(2));
-            } catch (JSONException e) {
-                e.printStackTrace();
-                throw new RuntimeException(e);
-            }
+                LOGGER.fine(acg.toJSON().asText());
         }
         return acg;
     }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d49bc6eb/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/dataflow/IConnectorDescriptor.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/dataflow/IConnectorDescriptor.java b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/dataflow/IConnectorDescriptor.java
index 7219040..abff2f7 100644
--- a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/dataflow/IConnectorDescriptor.java
+++ b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/dataflow/IConnectorDescriptor.java
@@ -21,6 +21,7 @@ package org.apache.hyracks.api.dataflow;
 import java.io.Serializable;
 import java.util.BitSet;
 
+import com.fasterxml.jackson.databind.JsonNode;
 import org.apache.hyracks.api.application.ICCApplicationContext;
 import org.apache.hyracks.api.comm.IFrameWriter;
 import org.apache.hyracks.api.comm.IPartitionCollector;
@@ -30,8 +31,6 @@ import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.RecordDescriptor;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.api.job.ActivityCluster;
-import org.json.JSONException;
-import org.json.JSONObject;
 
 /**
  * Connector that connects operators in a Job.
@@ -133,9 +132,8 @@ public interface IConnectorDescriptor extends Serializable {
      * Translate this connector descriptor to JSON.
      *
      * @return
-     * @throws JSONException
      */
-    public JSONObject toJSON() throws JSONException;
+    public JsonNode toJSON();
 
     /**
      * Sets the connector Id

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d49bc6eb/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/dataflow/IOperatorDescriptor.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/dataflow/IOperatorDescriptor.java b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/dataflow/IOperatorDescriptor.java
index 26561e6..b02c4f2 100644
--- a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/dataflow/IOperatorDescriptor.java
+++ b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/dataflow/IOperatorDescriptor.java
@@ -20,11 +20,11 @@ package org.apache.hyracks.api.dataflow;
 
 import java.io.Serializable;
 
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 import org.apache.hyracks.api.application.ICCApplicationContext;
 import org.apache.hyracks.api.constraints.IConstraintAcceptor;
 import org.apache.hyracks.api.dataflow.value.RecordDescriptor;
-import org.json.JSONException;
-import org.json.JSONObject;
 
 /**
  * Descriptor for operators in Hyracks.
@@ -99,5 +99,5 @@ public interface IOperatorDescriptor extends Serializable {
     /**
      * Translates this operator descriptor to JSON.
      */
-    public JSONObject toJSON() throws JSONException;
+    public ObjectNode toJSON();
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d49bc6eb/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/dataflow/value/JSONSerializable.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/dataflow/value/JSONSerializable.java b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/dataflow/value/JSONSerializable.java
index 391b637..23ae97b 100644
--- a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/dataflow/value/JSONSerializable.java
+++ b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/dataflow/value/JSONSerializable.java
@@ -18,14 +18,14 @@
  */
 package org.apache.hyracks.api.dataflow.value;
 
-import org.json.JSONException;
-import org.json.JSONObject;
+
+import com.fasterxml.jackson.databind.node.ObjectNode;
 
 public interface JSONSerializable {
     /**
      * Returns the JSON representation of the object.
      *
-     * @return A new JSONObject instance representing this Java object.
+     * @return A om.createObjectNode instance representing this Java object.
      */
-    public JSONObject toJSON() throws JSONException;
+    public ObjectNode toJSON() ;
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d49bc6eb/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/job/ActivityCluster.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/job/ActivityCluster.java b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/job/ActivityCluster.java
index cefdd7d..e5fad32 100644
--- a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/job/ActivityCluster.java
+++ b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/job/ActivityCluster.java
@@ -25,10 +25,11 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 import org.apache.commons.lang3.tuple.Pair;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
 
 import org.apache.hyracks.api.dataflow.ActivityId;
 import org.apache.hyracks.api.dataflow.ConnectorDescriptorId;
@@ -186,50 +187,50 @@ public class ActivityCluster implements Serializable {
         vList.set(index, value);
     }
 
-    public JSONObject toJSON() throws JSONException {
-        JSONObject jac = new JSONObject();
-
-        JSONArray jans = new JSONArray();
+    public JsonNode toJSON()  {
+        ObjectMapper om = new ObjectMapper();
+        ArrayNode jans = om.createArrayNode();
+        ObjectNode jac = om.createObjectNode();
         for (IActivity an : activities.values()) {
-            JSONObject jan = new JSONObject();
+            ObjectNode jan = om.createObjectNode();
             jan.put("id", an.getActivityId().toString());
             jan.put("java-class", an.getClass().getName());
 
             List<IConnectorDescriptor> inputs = activityInputMap.get(an.getActivityId());
             if (inputs != null) {
-                JSONArray jInputs = new JSONArray();
+                ArrayNode jInputs = om.createArrayNode();
                 for (int i = 0; i < inputs.size(); ++i) {
-                    JSONObject jInput = new JSONObject();
+                    ObjectNode jInput = om.createObjectNode();
                     jInput.put("input-port", i);
                     jInput.put("connector-id", inputs.get(i).getConnectorId().toString());
-                    jInputs.put(jInput);
+                    jInputs.add(jInput);
                 }
-                jan.put("inputs", jInputs);
+                jan.set("inputs", jInputs);
             }
 
             List<IConnectorDescriptor> outputs = activityOutputMap.get(an.getActivityId());
             if (outputs != null) {
-                JSONArray jOutputs = new JSONArray();
+                ArrayNode jOutputs = om.createArrayNode();
                 for (int i = 0; i < outputs.size(); ++i) {
-                    JSONObject jOutput = new JSONObject();
+                    ObjectNode jOutput = om.createObjectNode();
                     jOutput.put("output-port", i);
                     jOutput.put("connector-id", outputs.get(i).getConnectorId().toString());
-                    jOutputs.put(jOutput);
+                    jOutputs.add(jOutput);
                 }
-                jan.put("outputs", jOutputs);
+                jan.set("outputs", jOutputs);
             }
 
             Set<ActivityId> blockers = getBlocked2BlockerMap().get(an.getActivityId());
             if (blockers != null) {
-                JSONArray jDeps = new JSONArray();
+                ArrayNode jDeps = om.createArrayNode();
                 for (ActivityId blocker : blockers) {
-                    jDeps.put(blocker.toString());
+                    jDeps.add(blocker.toString());
                 }
-                jan.put("depends-on", jDeps);
+                jan.set("depends-on", jDeps);
             }
-            jans.put(jan);
+            jans.add(jan);
         }
-        jac.put("activities", jans);
+        jac.set("activities", jans);
 
         return jac;
     }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d49bc6eb/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/job/ActivityClusterGraph.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/job/ActivityClusterGraph.java b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/job/ActivityClusterGraph.java
index 7df619d..b64e2d5 100644
--- a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/job/ActivityClusterGraph.java
+++ b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/job/ActivityClusterGraph.java
@@ -24,10 +24,9 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 import org.apache.hyracks.api.dataflow.ActivityId;
 import org.apache.hyracks.api.dataflow.ConnectorDescriptorId;
 import org.apache.hyracks.api.dataflow.IConnectorDescriptor;
@@ -162,15 +161,15 @@ public class ActivityClusterGraph implements Serializable {
         return ac.getProducerActivity(cid);
     }
 
-    public JSONObject toJSON() throws JSONException {
-        JSONObject acgj = new JSONObject();
-
-        JSONArray acl = new JSONArray();
+    public ObjectNode toJSON()  {
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode acgj = om.createObjectNode();
+        ArrayNode acl = om.createArrayNode();
         for (ActivityCluster ac : activityClusterMap.values()) {
-            acl.put(ac.toJSON());
+            acl.add(ac.toJSON());
         }
         acgj.put("version", version);
-        acgj.put("activity-clusters", acl);
+        acgj.set("activity-clusters", acl);
         return acgj;
     }
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d49bc6eb/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/job/JobSpecification.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/job/JobSpecification.java b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/job/JobSpecification.java
index 7b44ff5..84a961e 100644
--- a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/job/JobSpecification.java
+++ b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/job/JobSpecification.java
@@ -18,6 +18,7 @@
  */
 package org.apache.hyracks.api.job;
 
+import java.io.IOException;
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -27,6 +28,10 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 import org.apache.commons.lang3.tuple.Pair;
 import org.apache.hyracks.api.constraints.Constraint;
 import org.apache.hyracks.api.constraints.expressions.ConstantExpression;
@@ -39,9 +44,6 @@ import org.apache.hyracks.api.dataflow.OperatorDescriptorId;
 import org.apache.hyracks.api.dataflow.connectors.IConnectorPolicyAssignmentPolicy;
 import org.apache.hyracks.api.dataflow.value.RecordDescriptor;
 import org.apache.hyracks.api.dataset.ResultSetId;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
 
 public class JobSpecification implements Serializable, IOperatorDescriptorRegistry, IConnectorDescriptorRegistry {
     private static final long serialVersionUID = 1L;
@@ -343,16 +345,17 @@ public class JobSpecification implements Serializable, IOperatorDescriptorRegist
     }
 
     @SuppressWarnings("incomplete-switch")
-    public JSONObject toJSON() throws JSONException {
-        JSONObject jjob = new JSONObject();
+    public ObjectNode toJSON() throws IOException {
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode jjob = om.createObjectNode();
 
-        JSONArray jopArray = new JSONArray();
+        ArrayNode jopArray = om.createArrayNode();
         for (Map.Entry<OperatorDescriptorId, IOperatorDescriptor> e : opMap.entrySet()) {
-            JSONObject op = e.getValue().toJSON();
+            ObjectNode op = e.getValue().toJSON();
             if (!userConstraints.isEmpty()) {
                 // Add operator partition constraints to each JSON operator.
-                JSONObject pcObject = new JSONObject();
-                JSONObject pleObject = new JSONObject();
+                ObjectNode pcObject = om.createObjectNode();
+                ObjectNode pleObject = om.createObjectNode();
                 Iterator<Constraint> test = userConstraints.iterator();
                 while (test.hasNext()) {
                     Constraint constraint = test.next();
@@ -372,20 +375,20 @@ public class JobSpecification implements Serializable, IOperatorDescriptorRegist
                             break;
                     }
                 }
-                if (pleObject.length() > 0) {
-                    pcObject.put("location", pleObject);
+                if (pleObject.size() > 0) {
+                    pcObject.set("location", pleObject);
                 }
-                if (pcObject.length() > 0) {
-                    op.put("partition-constraints", pcObject);
+                if (pcObject.size() > 0) {
+                    op.set("partition-constraints", pcObject);
                 }
             }
-            jopArray.put(op);
+            jopArray.add(op);
         }
-        jjob.put("operators", jopArray);
+        jjob.set("operators", jopArray);
 
-        JSONArray jcArray = new JSONArray();
+        ArrayNode jcArray = om.createArrayNode();
         for (Map.Entry<ConnectorDescriptorId, IConnectorDescriptor> e : connMap.entrySet()) {
-            JSONObject conn = new JSONObject();
+            ObjectNode conn = om.createObjectNode();
             Pair<Pair<IOperatorDescriptor, Integer>, Pair<IOperatorDescriptor, Integer>> connection = connectorOpMap
                     .get(e.getKey());
             if (connection != null) {
@@ -394,10 +397,10 @@ public class JobSpecification implements Serializable, IOperatorDescriptorRegist
                 conn.put("out-operator-id", connection.getRight().getLeft().getOperatorId().toString());
                 conn.put("out-operator-port", connection.getRight().getRight().intValue());
             }
-            conn.put("connector", e.getValue().toJSON());
-            jcArray.put(conn);
+            conn.set("connector", e.getValue().toJSON());
+            jcArray.add(conn);
         }
-        jjob.put("connectors", jcArray);
+        jjob.set("connectors", jcArray);
 
         return jjob;
     }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d49bc6eb/hyracks-fullstack/hyracks/hyracks-client/pom.xml
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-client/pom.xml b/hyracks-fullstack/hyracks/hyracks-client/pom.xml
index bf5d167..a532366 100644
--- a/hyracks-fullstack/hyracks/hyracks-client/pom.xml
+++ b/hyracks-fullstack/hyracks/hyracks-client/pom.xml
@@ -102,14 +102,13 @@
       <version>${project.version}</version>
     </dependency>
     <dependency>
-      <groupId>com.googlecode.json-simple</groupId>
-      <artifactId>json-simple</artifactId>
-      <version>1.1</version>
-    </dependency>
-    <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-databind</artifactId>
+    </dependency>
   </dependencies>
 </project>

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d49bc6eb/hyracks-fullstack/hyracks/hyracks-client/src/main/java/org/apache/hyracks/client/stats/impl/ClientCounterContext.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-client/src/main/java/org/apache/hyracks/client/stats/impl/ClientCounterContext.java b/hyracks-fullstack/hyracks/hyracks-client/src/main/java/org/apache/hyracks/client/stats/impl/ClientCounterContext.java
index 74b61b2..5d0865c 100644
--- a/hyracks-fullstack/hyracks/hyracks-client/src/main/java/org/apache/hyracks/client/stats/impl/ClientCounterContext.java
+++ b/hyracks-fullstack/hyracks/hyracks-client/src/main/java/org/apache/hyracks/client/stats/impl/ClientCounterContext.java
@@ -23,16 +23,12 @@ import java.io.IOException;
 import java.io.InputStreamReader;
 import java.net.HttpURLConnection;
 import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.json.simple.JSONArray;
-import org.json.simple.JSONObject;
-import org.json.simple.parser.JSONParser;
+import java.util.*;
 
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 import org.apache.hyracks.api.job.profiling.counters.ICounter;
 import org.apache.hyracks.client.stats.AggregateCounter;
 import org.apache.hyracks.client.stats.Counters;
@@ -44,7 +40,8 @@ import org.apache.hyracks.control.common.job.profiling.counters.Counter;
  */
 public class ClientCounterContext implements IClusterCounterContext {
     private static String[] RESET_COUNTERS = { Counters.NETWORK_IO_READ, Counters.NETWORK_IO_WRITE,
-            Counters.MEMORY_USAGE, Counters.MEMORY_MAX, Counters.DISK_READ, Counters.DISK_WRITE, Counters.NUM_PROCESSOR };
+            Counters.MEMORY_USAGE, Counters.MEMORY_MAX, Counters.DISK_READ, Counters.DISK_WRITE,
+            Counters.NUM_PROCESSOR };
     private static String[] AGG_COUNTERS = { Counters.SYSTEM_LOAD };
     private static int UPDATE_INTERVAL = 10000;
 
@@ -118,8 +115,8 @@ public class ClientCounterContext implements IClusterCounterContext {
     public ICounter getCounter(String machineName, String counterName, boolean create) {
         Counter counter = counterMap.get(machineName + "$" + counterName);
         if (counter == null) {
-            throw new IllegalStateException("request an unknown counter: " + counterName + " on slave machine "
-                    + machineName + "!");
+            throw new IllegalStateException(
+                    "request an unknown counter: " + counterName + " on slave machine " + machineName + "!");
         }
         return counter;
     }
@@ -132,11 +129,11 @@ public class ClientCounterContext implements IClusterCounterContext {
             reset();
             for (String slave : slaveMachines) {
                 String slaveProfile = requestProfile(slave);
-                JSONParser parser = new JSONParser();
-                JSONObject jo = (JSONObject) parser.parse(slaveProfile);
-                Object counterObject = jo.get("result");
-                if (counterObject instanceof JSONObject) {
-                    updateCounterMapWithJSONArray(slave, (JSONObject) counterObject);
+                ObjectMapper parser = new ObjectMapper();
+                JsonNode jo = parser.readTree(slaveProfile);
+                JsonNode counterObject = jo.get("result");
+                if (counterObject.isObject()) {
+                    updateCounterMapWithArrayNode(slave, counterObject);
                 }
             }
         } catch (Exception e) {
@@ -150,7 +147,7 @@ public class ClientCounterContext implements IClusterCounterContext {
      * @param jo
      *            the Profile JSON object
      */
-    private void updateCounterMapWithJSONArray(String slave, JSONObject jo) {
+    private void updateCounterMapWithArrayNode(String slave, JsonNode jo) {
         for (String counterName : RESET_COUNTERS) {
             updateCounter(slave, jo, counterName);
         }
@@ -160,8 +157,8 @@ public class ClientCounterContext implements IClusterCounterContext {
         }
     }
 
-    private void updateCounter(String slave, JSONObject jo, String counterName) {
-        Object counterObject = jo.get(counterName);
+    private void updateCounter(String slave, JsonNode jo, String counterName) {
+        JsonNode counterObject = jo.get(counterName);
         long counterValue = extractCounterValue(counterObject);
         // global counter
         ICounter counter = getCounter(counterName, true);
@@ -171,34 +168,30 @@ public class ClientCounterContext implements IClusterCounterContext {
         localCounter.set(counterValue);
     }
 
-    private long extractCounterValue(Object counterObject) {
+    private long extractCounterValue(JsonNode counterObject) {
         long counterValue = 0;
         if (counterObject == null) {
             return counterValue;
-        } else if (counterObject instanceof JSONArray) {
-            JSONArray jArray = (JSONArray) counterObject;
-            Object[] values = jArray.toArray();
+        } else if (counterObject.isObject()) {
             /**
              * use the last non-zero value as the counter value
              */
-            for (Object value : values) {
-                if (value instanceof Double) {
-                    Double dValue = (Double) value;
-                    double currentVal = dValue.doubleValue();
+            for (Iterator<JsonNode> jsonIt = counterObject.iterator(); jsonIt.hasNext();) {
+                JsonNode value = jsonIt.next();
+                if (value.isDouble()) {
+                    double currentVal = value.asDouble();
                     if (currentVal != 0) {
                         counterValue = (long) currentVal;
                     }
-                } else if (value instanceof Long) {
-                    Long lValue = (Long) value;
-                    long currentVal = lValue.longValue();
+                } else if (value.isLong()) {
+                    long currentVal = value.asLong();
                     if (currentVal != 0) {
-                        counterValue = lValue.longValue();
+                        counterValue = currentVal;
                     }
                 }
             }
         } else {
-            Long val = (Long) counterObject;
-            counterValue = val.longValue();
+            counterValue = counterObject.asLong();
         }
         return counterValue;
     }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d49bc6eb/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/pom.xml
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/pom.xml b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/pom.xml
index 350a7b3..636e1fe 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/pom.xml
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/pom.xml
@@ -102,14 +102,18 @@
       <version>${project.version}</version>
     </dependency>
     <dependency>
-      <groupId>org.json</groupId>
-      <artifactId>json</artifactId>
-      <version>20090211</version>
-    </dependency>
-    <dependency>
       <groupId>org.apache.commons</groupId>
       <artifactId>commons-lang3</artifactId>
       <version>3.5</version>
     </dependency>
+    <dependency>
+      <groupId>com.google.guava</groupId>
+      <artifactId>guava</artifactId>
+      <version>18.0</version>
+    </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-databind</artifactId>
+    </dependency>
   </dependencies>
 </project>

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d49bc6eb/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/NodeControllerState.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/NodeControllerState.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/NodeControllerState.java
index ca980b9..bf94dff 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/NodeControllerState.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/NodeControllerState.java
@@ -25,6 +25,8 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 import org.apache.hyracks.api.comm.NetworkAddress;
 import org.apache.hyracks.api.job.JobId;
 import org.apache.hyracks.control.common.base.INodeController;
@@ -33,8 +35,6 @@ import org.apache.hyracks.control.common.controllers.NodeRegistration;
 import org.apache.hyracks.control.common.heartbeat.HeartbeatData;
 import org.apache.hyracks.control.common.heartbeat.HeartbeatSchema;
 import org.apache.hyracks.control.common.heartbeat.HeartbeatSchema.GarbageCollectorInfo;
-import org.json.JSONException;
-import org.json.JSONObject;
 
 public class NodeControllerState {
     private static final int RRD_SIZE = 720;
@@ -277,13 +277,13 @@ public class NodeControllerState {
     public NetworkAddress getMessagingPort() {
         return messagingPort;
     }
-
     public int getNumCores() {
         return numCores;
     }
 
-    public synchronized JSONObject toSummaryJSON() throws JSONException {
-        JSONObject o = new JSONObject();
+    public synchronized ObjectNode toSummaryJSON()  {
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode o = om.createObjectNode();
         o.put("node-id", ncConfig.nodeId);
         o.put("heap-used", heapUsedSize[(rrdPtr + RRD_SIZE - 1) % RRD_SIZE]);
         o.put("system-load-average", systemLoadAverage[(rrdPtr + RRD_SIZE - 1) % RRD_SIZE]);
@@ -291,8 +291,9 @@ public class NodeControllerState {
         return o;
     }
 
-    public synchronized JSONObject toDetailedJSON(boolean includeStats, boolean includeConfig) throws JSONException {
-        JSONObject o = new JSONObject();
+    public synchronized ObjectNode toDetailedJSON(boolean includeStats, boolean includeConfig)  {
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode o = om.createObjectNode();
 
         o.put("node-id", ncConfig.nodeId);
 
@@ -304,45 +305,45 @@ public class NodeControllerState {
             o.put("vm-name", vmName);
             o.put("vm-version", vmVersion);
             o.put("vm-vendor", vmVendor);
-            o.put("classpath", classpath.split(File.pathSeparator));
-            o.put("library-path", libraryPath.split(File.pathSeparator));
-            o.put("boot-classpath", bootClasspath.split(File.pathSeparator));
-            o.put("input-arguments", inputArguments);
-            o.put("system-properties", systemProperties);
+            o.putPOJO("classpath", classpath.split(File.pathSeparator));
+            o.putPOJO("library-path", libraryPath.split(File.pathSeparator));
+            o.putPOJO("boot-classpath", bootClasspath.split(File.pathSeparator));
+            o.putPOJO("input-arguments", inputArguments);
+            o.putPOJO("system-properties", systemProperties);
             o.put("pid", pid);
         }
         if (includeStats) {
-            o.put("date", new Date());
+            o.putPOJO("date", new Date());
             o.put("rrd-ptr", rrdPtr);
-            o.put("heartbeat-times", hbTime);
-            o.put("heap-init-sizes", heapInitSize);
-            o.put("heap-used-sizes", heapUsedSize);
-            o.put("heap-committed-sizes", heapCommittedSize);
-            o.put("heap-max-sizes", heapMaxSize);
-            o.put("nonheap-init-sizes", nonheapInitSize);
-            o.put("nonheap-used-sizes", nonheapUsedSize);
-            o.put("nonheap-committed-sizes", nonheapCommittedSize);
-            o.put("nonheap-max-sizes", nonheapMaxSize);
-            o.put("thread-counts", threadCount);
-            o.put("peak-thread-counts", peakThreadCount);
-            o.put("system-load-averages", systemLoadAverage);
-            o.put("gc-names", gcNames);
-            o.put("gc-collection-counts", gcCollectionCounts);
-            o.put("gc-collection-times", gcCollectionTimes);
-            o.put("net-payload-bytes-read", netPayloadBytesRead);
-            o.put("net-payload-bytes-written", netPayloadBytesWritten);
-            o.put("net-signaling-bytes-read", netSignalingBytesRead);
-            o.put("net-signaling-bytes-written", netSignalingBytesWritten);
-            o.put("dataset-net-payload-bytes-read", datasetNetPayloadBytesRead);
-            o.put("dataset-net-payload-bytes-written", datasetNetPayloadBytesWritten);
-            o.put("dataset-net-signaling-bytes-read", datasetNetSignalingBytesRead);
-            o.put("dataset-net-signaling-bytes-written", datasetNetSignalingBytesWritten);
-            o.put("ipc-messages-sent", ipcMessagesSent);
-            o.put("ipc-message-bytes-sent", ipcMessageBytesSent);
-            o.put("ipc-messages-received", ipcMessagesReceived);
-            o.put("ipc-message-bytes-received", ipcMessageBytesReceived);
-            o.put("disk-reads", diskReads);
-            o.put("disk-writes", diskWrites);
+            o.putPOJO("heartbeat-times", hbTime);
+            o.putPOJO("heap-init-sizes", heapInitSize);
+            o.putPOJO("heap-used-sizes", heapUsedSize);
+            o.putPOJO("heap-committed-sizes", heapCommittedSize);
+            o.putPOJO("heap-max-sizes", heapMaxSize);
+            o.putPOJO("nonheap-init-sizes", nonheapInitSize);
+            o.putPOJO("nonheap-used-sizes", nonheapUsedSize);
+            o.putPOJO("nonheap-committed-sizes", nonheapCommittedSize);
+            o.putPOJO("nonheap-max-sizes", nonheapMaxSize);
+            o.putPOJO("thread-counts", threadCount);
+            o.putPOJO("peak-thread-counts", peakThreadCount);
+            o.putPOJO("system-load-averages", systemLoadAverage);
+            o.putPOJO("gc-names", gcNames);
+            o.putPOJO("gc-collection-counts", gcCollectionCounts);
+            o.putPOJO("gc-collection-times", gcCollectionTimes);
+            o.putPOJO("net-payload-bytes-read", netPayloadBytesRead);
+            o.putPOJO("net-payload-bytes-written", netPayloadBytesWritten);
+            o.putPOJO("net-signaling-bytes-read", netSignalingBytesRead);
+            o.putPOJO("net-signaling-bytes-written", netSignalingBytesWritten);
+            o.putPOJO("dataset-net-payload-bytes-read", datasetNetPayloadBytesRead);
+            o.putPOJO("dataset-net-payload-bytes-written", datasetNetPayloadBytesWritten);
+            o.putPOJO("dataset-net-signaling-bytes-read", datasetNetSignalingBytesRead);
+            o.putPOJO("dataset-net-signaling-bytes-written", datasetNetSignalingBytesWritten);
+            o.putPOJO("ipc-messages-sent", ipcMessagesSent);
+            o.putPOJO("ipc-message-bytes-sent", ipcMessageBytesSent);
+            o.putPOJO("ipc-messages-received", ipcMessagesReceived);
+            o.putPOJO("ipc-message-bytes-received", ipcMessageBytesReceived);
+            o.putPOJO("disk-reads", diskReads);
+            o.putPOJO("disk-writes", diskWrites);
         }
 
         return o;


Mime
View raw message