ASTERIXDB-1714: Eliminate dependency on org.json

Change-Id: Ie9c5400fd134ae75d43385255af7794e968b1c7e
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1392
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
BAD: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Till Westmann <tillw@apache.org>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
diff --git a/asterixdb/asterix-algebra/pom.xml b/asterixdb/asterix-algebra/pom.xml
index f53997e..dc195e2 100644
--- a/asterixdb/asterix-algebra/pom.xml
+++ b/asterixdb/asterix-algebra/pom.xml
@@ -171,10 +171,6 @@
       <artifactId>algebricks-rewriter</artifactId>
     </dependency>
     <dependency>
-      <groupId>org.json</groupId>
-      <artifactId>json</artifactId>
-    </dependency>
-    <dependency>
       <groupId>org.apache.commons</groupId>
       <artifactId>commons-lang3</artifactId>
       <version>3.5</version>
diff --git a/asterixdb/asterix-app/pom.xml b/asterixdb/asterix-app/pom.xml
index 79c0c6a..ae93779 100644
--- a/asterixdb/asterix-app/pom.xml
+++ b/asterixdb/asterix-app/pom.xml
@@ -196,16 +196,6 @@
       <scope>compile</scope>
     </dependency>
     <dependency>
-      <groupId>com.fasterxml.jackson.core</groupId>
-      <artifactId>jackson-core</artifactId>
-      <version>2.8.4</version>
-    </dependency>
-    <dependency>
-      <groupId>com.fasterxml.jackson.core</groupId>
-      <artifactId>jackson-databind</artifactId>
-      <version>2.8.4</version>
-    </dependency>
-    <dependency>
       <groupId>org.apache.hyracks</groupId>
       <artifactId>hyracks-control-cc</artifactId>
     </dependency>
@@ -326,5 +316,13 @@
       <type>jar</type>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-databind</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-core</artifactId>
+    </dependency>
   </dependencies>
 </project>
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/common/APIFramework.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/common/APIFramework.java
index f9794e4..754b7f9 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/common/APIFramework.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/common/APIFramework.java
@@ -18,7 +18,6 @@
  */
 package org.apache.asterix.api.common;
 
-
 import java.io.IOException;
 import java.io.PrintWriter;
 import java.rmi.RemoteException;
@@ -30,6 +29,7 @@
 import java.util.Random;
 import java.util.Set;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
 import org.apache.asterix.algebra.base.ILangExpressionToPlanTranslator;
 import org.apache.asterix.algebra.base.ILangExpressionToPlanTranslatorFactory;
 import org.apache.asterix.api.common.Job.SubmissionMode;
@@ -90,7 +90,6 @@
 import org.apache.hyracks.api.client.NodeControllerInfo;
 import org.apache.hyracks.api.job.JobId;
 import org.apache.hyracks.api.job.JobSpecification;
-import org.json.JSONException;
 
 /**
  * Provides helper methods for compilation of a query into a JobSpec and submission
@@ -161,9 +160,8 @@
         return new Pair<>(q, q.getVarCounter());
     }
 
-    public JobSpecification compileQuery(IClusterInfoCollector clusterInfoCollector,
-            MetadataProvider metadataProvider, Query rwQ, int varCounter, String outputDatasetName,
-            SessionConfig conf, ICompiledDmlStatement statement)
+    public JobSpecification compileQuery(IClusterInfoCollector clusterInfoCollector, MetadataProvider metadataProvider,
+            Query rwQ, int varCounter, String outputDatasetName, SessionConfig conf, ICompiledDmlStatement statement)
             throws AlgebricksException, RemoteException, ACIDException {
 
         if (!conf.is(SessionConfig.FORMAT_ONLY_PHYSICAL_OPS) && conf.is(SessionConfig.OOB_REWRITTEN_EXPR_TREE)) {
@@ -178,8 +176,8 @@
 
         org.apache.asterix.common.transactions.JobId asterixJobId = JobIdFactory.generateJobId();
         metadataProvider.setJobId(asterixJobId);
-        ILangExpressionToPlanTranslator t =
-                translatorFactory.createExpressionToPlanTranslator(metadataProvider, varCounter);
+        ILangExpressionToPlanTranslator t = translatorFactory.createExpressionToPlanTranslator(metadataProvider,
+                varCounter);
 
         ILogicalPlan plan;
         // statement = null when it's a query
@@ -217,8 +215,8 @@
         OptimizationConfUtil.getPhysicalOptimizationConfig().setMaxFramesExternalGroupBy(groupFrameLimit);
         OptimizationConfUtil.getPhysicalOptimizationConfig().setMaxFramesForJoin(joinFrameLimit);
 
-        HeuristicCompilerFactoryBuilder builder =
-                new HeuristicCompilerFactoryBuilder(OptimizationContextFactory.INSTANCE);
+        HeuristicCompilerFactoryBuilder builder = new HeuristicCompilerFactoryBuilder(
+                OptimizationContextFactory.INSTANCE);
         builder.setPhysicalOptimizationConfig(OptimizationConfUtil.getPhysicalOptimizationConfig());
         builder.setLogicalRewrites(ruleSetFactory.getLogicalRewrites());
         builder.setPhysicalRewrites(ruleSetFactory.getPhysicalRewrites());
@@ -304,16 +302,17 @@
         builder.setTypeTraitProvider(format.getTypeTraitProvider());
         builder.setNormalizedKeyComputerFactoryProvider(format.getNormalizedKeyComputerFactoryProvider());
 
-        JobEventListenerFactory jobEventListenerFactory =
-                new JobEventListenerFactory(asterixJobId, metadataProvider.isWriteTransaction());
+        JobEventListenerFactory jobEventListenerFactory = new JobEventListenerFactory(asterixJobId,
+                metadataProvider.isWriteTransaction());
         JobSpecification spec = compiler.createJob(AppContextInfo.INSTANCE, jobEventListenerFactory);
 
         if (conf.is(SessionConfig.OOB_HYRACKS_JOB)) {
             printPlanPrefix(conf, "Hyracks job");
             if (rwQ != null) {
                 try {
-                    conf.out().println(spec.toJSON().toString(1));
-                } catch (JSONException e) {
+                    conf.out().println(
+                            new ObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(spec.toJSON()));
+                } catch (IOException e) {
                     throw new AlgebricksException(e);
                 }
                 conf.out().println(spec.getUserConstraints());
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/ClusterAPIServlet.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/ClusterAPIServlet.java
index 02be70b..988b5bb 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/ClusterAPIServlet.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/ClusterAPIServlet.java
@@ -31,12 +31,17 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+import org.apache.asterix.common.config.AsterixProperties;
+import org.apache.asterix.common.config.ExternalProperties;
+import org.apache.asterix.common.utils.JSONUtil;
 import org.apache.asterix.common.config.AbstractProperties;
 import org.apache.asterix.common.config.ReplicationProperties;
 import org.apache.asterix.runtime.util.ClusterStateManager;
-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 ClusterAPIServlet extends HttpServlet {
     private static final long serialVersionUID = 1L;
@@ -53,6 +58,7 @@
     protected static final String REPLICATION_URI_KEY = "replicationUri";
     private static final Pattern PARENT_DIR = Pattern.compile("/[^./]+/\\.\\./");
     private static final Pattern REPLICATION_PROPERTY = Pattern.compile("^replication\\.");
+    private final ObjectMapper om = new ObjectMapper();
 
     @Override
     public final void doGet(HttpServletRequest request, HttpServletResponse response) {
@@ -67,9 +73,8 @@
         response.setContentType("application/json");
         response.setCharacterEncoding("utf-8");
         PrintWriter responseWriter = response.getWriter();
-        JSONObject json;
-
         try {
+            ObjectNode json;
             switch (request.getPathInfo() == null ? "" : request.getPathInfo()) {
                 case "":
                     json = getClusterStateJSON(request, "");
@@ -84,7 +89,7 @@
                     throw new IllegalArgumentException();
             }
             response.setStatus(HttpServletResponse.SC_OK);
-            responseWriter.write(json.toString(4));
+            responseWriter.write(JSONUtil.convertNode(json));
         } catch (IllegalArgumentException e) { // NOSONAR - exception not logged or rethrown
             response.sendError(HttpServletResponse.SC_NOT_FOUND);
         } catch (Exception e) {
@@ -94,15 +99,15 @@
         responseWriter.flush();
     }
 
-    protected JSONObject getClusterStateSummaryJSON() throws JSONException {
+    protected ObjectNode getClusterStateSummaryJSON() {
         return ClusterStateManager.INSTANCE.getClusterStateSummary();
     }
 
-    protected JSONObject getReplicationJSON() throws JSONException {
+    protected ObjectNode getReplicationJSON() {
         for (AbstractProperties props : getPropertiesInstances()) {
             if (props instanceof ReplicationProperties) {
-                JSONObject json = new JSONObject();
-                json.put("config", props.getProperties(key -> REPLICATION_PROPERTY.matcher(key).replaceFirst("")));
+                ObjectNode json = om.createObjectNode();
+                json.putPOJO("config", props.getProperties(key -> REPLICATION_PROPERTY.matcher(key).replaceFirst("")));
                 return json;
             }
         }
@@ -123,13 +128,12 @@
         return AbstractProperties.getImplementations();
     }
 
-    protected JSONObject getClusterStateJSON(HttpServletRequest request, String pathToNode) throws JSONException {
-        JSONObject json;
-        json = ClusterStateManager.INSTANCE.getClusterStateDescription();
+    protected ObjectNode getClusterStateJSON(HttpServletRequest request, String pathToNode) {
+        ObjectNode json = ClusterStateManager.INSTANCE.getClusterStateDescription();
         Map<String, Object> allProperties = getAllClusterProperties();
-        json.put("config", allProperties);
+        json.putPOJO("config", allProperties);
 
-        JSONArray ncs = json.getJSONArray("ncs");
+        ArrayNode ncs = (ArrayNode) json.get("ncs");
         final StringBuilder requestURL = new StringBuilder(request.getRequestURL());
         if (requestURL.charAt(requestURL.length() - 1) != '/') {
             requestURL.append('/');
@@ -138,18 +142,18 @@
         String clusterURL = canonicalize(requestURL);
         String adminURL = canonicalize(clusterURL + "../");
         String nodeURL = clusterURL + "node/";
-        for (int i = 0; i < ncs.length(); i++) {
-            JSONObject nc = ncs.getJSONObject(i);
-            nc.put(CONFIG_URI_KEY, nodeURL + nc.getString(NODE_ID_KEY) + "/config");
-            nc.put(STATS_URI_KEY, nodeURL + nc.getString(NODE_ID_KEY) + "/stats");
-            nc.put(THREAD_DUMP_URI_KEY, nodeURL + nc.getString(NODE_ID_KEY) + "/threaddump");
+        for (int i = 0; i < ncs.size(); i++) {
+            ObjectNode nc = (ObjectNode) ncs.get(i);
+            nc.put(CONFIG_URI_KEY, nodeURL + nc.get(NODE_ID_KEY).asText() + "/config");
+            nc.put(STATS_URI_KEY, nodeURL + nc.get(NODE_ID_KEY).asText() + "/stats");
+            nc.put(THREAD_DUMP_URI_KEY, nodeURL + nc.get(NODE_ID_KEY).asText() + "/threaddump");
         }
-        JSONObject cc;
+        ObjectNode cc;
         if (json.has("cc")) {
-            cc = json.getJSONObject("cc");
+            cc = (ObjectNode) json.get("cc");
         } else {
-            cc = new JSONObject();
-            json.put("cc", cc);
+            cc = om.createObjectNode();
+            json.set("cc", cc);
         }
         cc.put(CONFIG_URI_KEY, clusterURL + "cc/config");
         cc.put(STATS_URI_KEY, clusterURL + "cc/stats");
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/ClusterCCDetailsAPIServlet.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/ClusterCCDetailsAPIServlet.java
index 75fba74..569d5a0 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/ClusterCCDetailsAPIServlet.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/ClusterCCDetailsAPIServlet.java
@@ -29,30 +29,31 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
 import org.apache.hyracks.api.client.IHyracksClientConnection;
-import org.json.JSONObject;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 
 public class ClusterCCDetailsAPIServlet extends ClusterAPIServlet {
     private static final long serialVersionUID = 1L;
     private static final Logger LOGGER = Logger.getLogger(ClusterCCDetailsAPIServlet.class.getName());
+    private final ObjectMapper om = new ObjectMapper();
 
     @Override
     protected void getUnsafe(HttpServletRequest request, HttpServletResponse response) throws IOException {
         PrintWriter responseWriter = response.getWriter();
         ServletContext context = getServletContext();
         IHyracksClientConnection hcc = (IHyracksClientConnection) context.getAttribute(HYRACKS_CONNECTION_ATTR);
-        JSONObject json;
-
         try {
+            ObjectNode json;
             if (request.getPathInfo() == null) {
-                json = getClusterStateJSON(request, "../").getJSONObject("cc");
+                json = (ObjectNode) getClusterStateJSON(request, "../").get("cc");
             } else {
                 json = processNode(request, hcc);
             }
             response.setStatus(HttpServletResponse.SC_OK);
             response.setContentType("application/json");
             response.setCharacterEncoding("utf-8");
-            responseWriter.write(json.toString(4));
+            responseWriter.write(new ObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(json));
         } catch (IllegalArgumentException e) { // NOSONAR - exception not logged or rethrown
             response.sendError(HttpServletResponse.SC_NOT_FOUND);
         } catch (Exception e) {
@@ -62,8 +63,7 @@
         responseWriter.flush();
     }
 
-    private JSONObject processNode(HttpServletRequest request, IHyracksClientConnection hcc)
-            throws Exception {
+    private ObjectNode processNode(HttpServletRequest request, IHyracksClientConnection hcc) throws Exception {
         String pathInfo = request.getPathInfo();
         if (pathInfo.endsWith("/")) {
             throw new IllegalArgumentException();
@@ -71,13 +71,13 @@
         String[] parts = pathInfo.substring(1).split("/");
 
         if (request.getPathInfo() == null) {
-            return getClusterStateJSON(request, "../../").getJSONObject("cc");
+            return (ObjectNode) getClusterStateJSON(request, "../../").get("cc");
         } else if (parts.length == 1) {
             switch (parts[0]) {
                 case "config":
-                    return new JSONObject(hcc.getNodeDetailsJSON(null, false, true));
+                    return om.readValue(hcc.getNodeDetailsJSON(null, false, true), ObjectNode.class);
                 case "stats":
-                    return new JSONObject(hcc.getNodeDetailsJSON(null, true, false));
+                    return om.readValue(hcc.getNodeDetailsJSON(null, true, false), ObjectNode.class);
                 case "threaddump":
                     return processCCThreadDump(hcc);
 
@@ -90,12 +90,12 @@
         }
     }
 
-    private JSONObject processCCThreadDump(IHyracksClientConnection hcc) throws Exception {
+    private ObjectNode processCCThreadDump(IHyracksClientConnection hcc) throws Exception {
         String dump = hcc.getThreadDump(null);
         if (dump == null) {
             throw new IllegalArgumentException();
         }
-        return new JSONObject(dump);
+        return (ObjectNode) om.readTree(dump);
     }
 
 }
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/ClusterNodeDetailsAPIServlet.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/ClusterNodeDetailsAPIServlet.java
index 1489e55..590e869 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/ClusterNodeDetailsAPIServlet.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/ClusterNodeDetailsAPIServlet.java
@@ -29,37 +29,45 @@
 import java.util.logging.Logger;
 
 import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
 import org.apache.asterix.runtime.util.ClusterStateManager;
 import org.apache.hyracks.api.client.IHyracksClientConnection;
-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 ClusterNodeDetailsAPIServlet extends ClusterAPIServlet {
     private static final long serialVersionUID = 1L;
     private static final Logger LOGGER = Logger.getLogger(ClusterNodeDetailsAPIServlet.class.getName());
+    private final ObjectMapper om = new ObjectMapper();
+
+    @Override
+    public void init() throws ServletException{
+        om.enable(SerializationFeature.INDENT_OUTPUT);
+    }
 
     @Override
     protected void getUnsafe(HttpServletRequest request, HttpServletResponse response) throws IOException {
         PrintWriter responseWriter = response.getWriter();
         ServletContext context = getServletContext();
         IHyracksClientConnection hcc = (IHyracksClientConnection) context.getAttribute(HYRACKS_CONNECTION_ATTR);
-        JSONObject json;
-
         try {
+            ObjectNode json;
             if (request.getPathInfo() == null) {
-                json = new JSONObject();
-                json.put("ncs", getClusterStateJSON(request, "../").getJSONArray("ncs"));
+                json = om.createObjectNode();
+                json.set("ncs", getClusterStateJSON(request, "../").get("ncs"));
             } else {
                 json = processNode(request, hcc);
             }
             response.setStatus(HttpServletResponse.SC_OK);
             response.setContentType("application/json");
             response.setCharacterEncoding("utf-8");
-            responseWriter.write(json.toString(4));
+            responseWriter.write(om.writerWithDefaultPrettyPrinter().writeValueAsString(json));
         } catch (IllegalStateException e) { // NOSONAR - exception not logged or rethrown
             response.sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE);
         } catch (IllegalArgumentException e) { // NOSONAR - exception not logged or rethrown
@@ -71,7 +79,7 @@
         responseWriter.flush();
     }
 
-    private JSONObject processNode(HttpServletRequest request, IHyracksClientConnection hcc)
+    private ObjectNode processNode(HttpServletRequest request, IHyracksClientConnection hcc)
             throws Exception {
         String pathInfo = request.getPathInfo();
         if (pathInfo.endsWith("/")) {
@@ -81,19 +89,18 @@
         final String node = parts[0];
 
         if (parts.length == 1) {
-            JSONArray ncs = getClusterStateJSON(request, "../../").getJSONArray("ncs");
-            for (int i = 0; i < ncs.length(); i++) {
-                JSONObject json = ncs.getJSONObject(i);
-                if (node.equals(json.getString("node_id"))) {
-                    return json;
+            ArrayNode ncs = (ArrayNode) getClusterStateJSON(request, "../../").get("ncs");
+            for (int i = 0; i < ncs.size(); i++) {
+                if (node.equals(ncs.get(i).get("node_id").asText())) {
+                    return (ObjectNode) ncs.get(i);
                 }
             }
             if ("cc".equals(node)) {
-                return new JSONObject();
+                return om.createObjectNode();
             }
             throw new IllegalArgumentException();
         } else if (parts.length == 2) {
-            JSONObject json;
+            ObjectNode json;
 
             switch (parts[1]) {
                 case "config":
@@ -118,78 +125,78 @@
         }
     }
 
-    protected JSONObject fixupKeys(JSONObject json) throws JSONException {
+    protected ObjectNode fixupKeys(ObjectNode json)  {
         // TODO (mblow): generate the keys with _ to begin with
         List<String> keys = new ArrayList<>();
-        for (Iterator iter = json.keys(); iter.hasNext(); ) {
+        for (Iterator iter = json.fieldNames(); iter.hasNext(); ) {
             keys.add((String) iter.next());
         }
         for (String key : keys) {
             String newKey = key.replace('-', '_');
             if (!newKey.equals(key)) {
-                json.put(newKey, json.remove(key));
+                json.set(newKey, json.remove(key));
             }
         }
         return json;
     }
 
-    protected JSONObject processNodeStats(IHyracksClientConnection hcc, String node) throws Exception {
+    protected ObjectNode processNodeStats(IHyracksClientConnection hcc, String node) throws Exception {
         final String details = hcc.getNodeDetailsJSON(node, true, false);
         if (details == null) {
             throw new IllegalArgumentException();
         }
-        JSONObject json = new JSONObject(details);
-        int index = json.getInt("rrd-ptr") - 1;
+        ObjectNode json = (ObjectNode) om.readTree(details);
+        int index = json.get("rrd-ptr").asInt() - 1;
         json.remove("rrd-ptr");
 
         List<String> keys = new ArrayList<>();
-        for (Iterator iter = json.keys(); iter.hasNext(); ) {
+        for (Iterator iter = json.fieldNames(); iter.hasNext(); ) {
             keys.add((String) iter.next());
         }
 
-        final JSONArray gcNames = json.getJSONArray("gc-names");
-        final JSONArray gcCollectionTimes = json.getJSONArray("gc-collection-times");
-        final JSONArray gcCollectionCounts = json.getJSONArray("gc-collection-counts");
+        final ArrayNode gcNames = (ArrayNode) json.get("gc-names");
+        final ArrayNode gcCollectionTimes  = (ArrayNode) json.get("gc-collection-times");
+        final ArrayNode gcCollectionCounts = (ArrayNode) json.get("gc-collection-counts");
 
         for (String key : keys) {
             if (key.startsWith("gc-")) {
                 json.remove(key);
-            } else if (json.get(key) instanceof JSONArray) {
-                final JSONArray valueArray = json.getJSONArray(key);
+            } else if (json.get(key) instanceof ArrayNode) {
+                final ArrayNode valueArray = (ArrayNode) json.get(key);
                 // fixup an index of -1 to the final element in the array (i.e. RRD_SIZE)
                 if (index == -1) {
-                    index = valueArray.length() - 1;
+                    index = valueArray.size() - 1;
                 }
                 final Object value = valueArray.get(index);
                 json.remove(key);
-                json.put(key.replaceAll("s$",""), value);
+                json.putPOJO(key.replaceAll("s$",""), value);
             }
         }
-        List<JSONObject> gcs = new ArrayList<>();
+        List<ObjectNode> gcs = new ArrayList<>();
 
-        for (int i = 0; i < gcNames.length(); i++) {
-            JSONObject gc = new JSONObject();
-            gc.put("name", gcNames.get(i));
-            gc.put("collection-time", ((JSONArray)gcCollectionTimes.get(i)).get(index));
-            gc.put("collection-count", ((JSONArray)gcCollectionCounts.get(i)).get(index));
+        for (int i = 0; i < gcNames.size(); i++) {
+            ObjectNode gc = om.createObjectNode();
+            gc.set("name", gcNames.get(i));
+            gc.set("collection-time", ((ArrayNode)gcCollectionTimes.get(i)).get(index));
+            gc.set("collection-count", ((ArrayNode)gcCollectionCounts.get(i)).get(index));
             gcs.add(gc);
         }
-        json.put("gcs", gcs);
+        json.putPOJO("gcs", gcs);
 
         return json;
     }
 
-    private JSONObject processNodeConfig(IHyracksClientConnection hcc, String node) throws Exception {
+    private ObjectNode processNodeConfig(IHyracksClientConnection hcc, String node) throws Exception {
         String config = hcc.getNodeDetailsJSON(node, false, true);
         if (config == null) {
             throw new IllegalArgumentException();
         }
-        return new JSONObject(config);
+        return (ObjectNode) om.readTree(config);
     }
 
-    private JSONObject processNodeThreadDump(IHyracksClientConnection hcc, String node) throws Exception {
+    private ObjectNode processNodeThreadDump(IHyracksClientConnection hcc, String node) throws Exception {
         if ("cc".equals(node)) {
-            return new JSONObject();
+            return om.createObjectNode();
         }
         String dump = hcc.getThreadDump(node);
         if (dump == null) {
@@ -198,7 +205,7 @@
                     ? new IllegalStateException()
                     : new IllegalArgumentException();
         }
-        return new JSONObject(dump);
+        return (ObjectNode) om.readTree(dump);
     }
 
 }
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/ConnectorAPIServlet.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/ConnectorAPIServlet.java
index ac1a5aa..78801b8 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/ConnectorAPIServlet.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/ConnectorAPIServlet.java
@@ -30,7 +30,7 @@
 import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-
+import com.fasterxml.jackson.databind.ObjectMapper;
 import org.apache.asterix.metadata.MetadataManager;
 import org.apache.asterix.metadata.MetadataTransactionContext;
 import org.apache.asterix.metadata.declared.MetadataProvider;
@@ -40,10 +40,9 @@
 import org.apache.asterix.util.FlushDatasetUtils;
 import org.apache.hyracks.api.client.IHyracksClientConnection;
 import org.apache.hyracks.api.client.NodeControllerInfo;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 import org.apache.hyracks.api.io.FileSplit;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
 
 /***
  * The REST API that takes a dataverse name and a dataset name as the input
@@ -62,7 +61,8 @@
         response.setCharacterEncoding("utf-8");
         PrintWriter out = response.getWriter();
         try {
-            JSONObject jsonResponse = new JSONObject();
+            ObjectMapper om = new ObjectMapper();
+            ObjectNode jsonResponse = om.createObjectNode();
             String dataverseName = request.getParameter("dataverseName");
             String datasetName = request.getParameter("datasetName");
             if (dataverseName == null || datasetName == null) {
@@ -94,8 +94,8 @@
                 return;
             }
             boolean temp = dataset.getDatasetDetails().isTemp();
-            FileSplit[] fileSplits =
-                    metadataProvider.splitsForDataset(mdTxnCtx, dataverseName, datasetName, datasetName, temp);
+            FileSplit[] fileSplits = metadataProvider.splitsForDataset(mdTxnCtx, dataverseName, datasetName,
+                    datasetName, temp);
             ARecordType recordType = (ARecordType) metadataProvider.findType(dataset.getItemTypeDataverseName(),
                     dataset.getItemTypeName());
             List<List<String>> primaryKeys = DatasetUtils.getPartitioningKeys(dataset);
@@ -127,24 +127,25 @@
         }
     }
 
-    private void formResponseObject(JSONObject jsonResponse, FileSplit[] fileSplits, ARecordType recordType,
+    private void formResponseObject(ObjectNode jsonResponse, FileSplit[] fileSplits, ARecordType recordType,
             String primaryKeys, boolean temp, Map<String, NodeControllerInfo> nodeMap) throws Exception {
-        JSONArray partititons = new JSONArray();
+        ObjectMapper om = new ObjectMapper();
+        ArrayNode partititons = om.createArrayNode();
         // Whether the dataset is temp or not
         jsonResponse.put("temp", temp);
         // Adds a primary key.
         jsonResponse.put("keys", primaryKeys);
         // Adds record type.
-        jsonResponse.put("type", recordType.toJSON());
+        jsonResponse.set("type", recordType.toJSON());
         // Generates file partitions.
         for (FileSplit split : fileSplits) {
             String ipAddress = nodeMap.get(split.getNodeName()).getNetworkAddress().getAddress().toString();
             String path = split.getPath();
             FilePartition partition = new FilePartition(ipAddress, path);
-            partititons.put(partition.toJSONObject());
+            partititons.add(partition.toObjectNode());
         }
         // Generates the response object which contains the splits.
-        jsonResponse.put("splits", partititons);
+        jsonResponse.set("splits", partititons);
     }
 }
 
@@ -170,8 +171,9 @@
         return ipAddress + ":" + path;
     }
 
-    public JSONObject toJSONObject() throws JSONException {
-        JSONObject partition = new JSONObject();
+    public ObjectNode toObjectNode() {
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode partition = om.createObjectNode();
         partition.put("ip", ipAddress);
         partition.put("path", path);
         return partition;
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/DiagnosticsAPIServlet.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/DiagnosticsAPIServlet.java
index c709ab5..4416d5c 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/DiagnosticsAPIServlet.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/DiagnosticsAPIServlet.java
@@ -32,14 +32,14 @@
 import java.util.concurrent.Future;
 import java.util.logging.Level;
 import java.util.logging.Logger;
-
 import javax.servlet.ServletContext;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
 import org.apache.asterix.runtime.util.AppContextInfo;
 import org.apache.hyracks.api.client.IHyracksClientConnection;
-import org.json.JSONObject;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 
 public class DiagnosticsAPIServlet extends ClusterNodeDetailsAPIServlet {
     private static final long serialVersionUID = 1L;
@@ -50,14 +50,16 @@
         response.setContentType("application/json");
         response.setCharacterEncoding("utf-8");
         PrintWriter responseWriter = response.getWriter();
-        JSONObject json;
+        ObjectNode json;
+        ObjectMapper om = new ObjectMapper();
+        om.enable(SerializationFeature.INDENT_OUTPUT);
         try {
             if (request.getPathInfo() != null) {
                 throw new IllegalArgumentException();
             }
             json = getClusterDiagnosticsJSON();
             response.setStatus(HttpServletResponse.SC_OK);
-            responseWriter.write(json.toString(4));
+            responseWriter.write(om.writerWithDefaultPrettyPrinter().writeValueAsString(json));
         } catch (IllegalStateException e) { // NOSONAR - exception not logged or rethrown
             response.sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE);
         } catch (IllegalArgumentException e) { // NOSONAR - exception not logged or rethrown
@@ -69,47 +71,46 @@
         responseWriter.flush();
     }
 
-    private JSONObject getClusterDiagnosticsJSON() throws Exception {
+    private ObjectNode getClusterDiagnosticsJSON() throws Exception {
+        ObjectMapper om = new ObjectMapper();
         final ServletContext context = getServletContext();
-        IHyracksClientConnection hcc =
-                (IHyracksClientConnection) context.getAttribute(HYRACKS_CONNECTION_ATTR);
+        IHyracksClientConnection hcc = (IHyracksClientConnection) context.getAttribute(HYRACKS_CONNECTION_ATTR);
         ExecutorService executor = (ExecutorService) context.getAttribute(ServletConstants.EXECUTOR_SERVICE);
 
-        Map<String, Future<JSONObject>> ccFutureData = new HashMap<>();
-        ccFutureData.put("threaddump", executor.submit(() -> fixupKeys(new JSONObject(hcc.getThreadDump(null)))));
-        ccFutureData.put("config", executor.submit(() ->
-                fixupKeys(new JSONObject(hcc.getNodeDetailsJSON(null, false, true)))));
-        ccFutureData.put("stats", executor.submit(() ->
-                fixupKeys(new JSONObject(hcc.getNodeDetailsJSON(null, true, false)))));
+        Map<String, Future<ObjectNode>> ccFutureData = new HashMap<>();
+        ccFutureData.put("threaddump",
+                executor.submit(() -> fixupKeys((ObjectNode) om.readTree(hcc.getThreadDump(null)))));
+        ccFutureData.put("config",
+                executor.submit(() -> fixupKeys((ObjectNode) om.readTree(hcc.getNodeDetailsJSON(null, false, true)))));
+        ccFutureData.put("stats",
+                executor.submit(() -> fixupKeys((ObjectNode) om.readTree(hcc.getNodeDetailsJSON(null, true, false)))));
 
-        Map<String, Map<String, Future<JSONObject>>> ncDataMap = new HashMap<>();
+        Map<String, Map<String, Future<ObjectNode>>> ncDataMap = new HashMap<>();
         for (String nc : AppContextInfo.INSTANCE.getMetadataProperties().getNodeNames()) {
-            Map<String, Future<JSONObject>> ncData = new HashMap<>();
-            ncData.put("threaddump", executor.submit(() ->
-                    fixupKeys(new JSONObject(hcc.getThreadDump(nc)))));
-            ncData.put("config", executor.submit(() ->
-                    fixupKeys(new JSONObject(hcc.getNodeDetailsJSON(nc, false, true)))));
-            ncData.put("stats", executor.submit(() ->
-                    fixupKeys(processNodeStats(hcc, nc))));
+            Map<String, Future<ObjectNode>> ncData = new HashMap<>();
+            ncData.put("threaddump", executor.submit(() -> fixupKeys((ObjectNode) om.readTree(hcc.getThreadDump(nc)))));
+            ncData.put("config", executor
+                    .submit(() -> fixupKeys((ObjectNode) om.readTree(hcc.getNodeDetailsJSON(nc, false, true)))));
+            ncData.put("stats", executor.submit(() -> fixupKeys(processNodeStats(hcc, nc))));
             ncDataMap.put(nc, ncData);
         }
-        JSONObject result = new JSONObject();
-        result.put("cc", resolveFutures(ccFutureData));
+        ObjectNode result = om.createObjectNode();
+        result.putPOJO("cc", resolveFutures(ccFutureData));
         List<Map<String, ?>> ncList = new ArrayList<>();
-        for (Map.Entry<String, Map<String, Future<JSONObject>>> entry : ncDataMap.entrySet()) {
+        for (Map.Entry<String, Map<String, Future<ObjectNode>>> entry : ncDataMap.entrySet()) {
             final Map<String, Object> ncMap = resolveFutures(entry.getValue());
             ncMap.put("node_id", entry.getKey());
             ncList.add(ncMap);
         }
-        result.put("ncs", ncList);
-        result.put("date", new Date());
+        result.putPOJO("ncs", ncList);
+        result.putPOJO("date", new Date());
         return result;
     }
 
-    private Map<String, Object> resolveFutures(Map<String, Future<JSONObject>> futureMap)
+    private Map<String, Object> resolveFutures(Map<String, Future<ObjectNode>> futureMap)
             throws ExecutionException, InterruptedException {
         Map<String, Object> result = new HashMap<>();
-        for (Map.Entry<String, Future<JSONObject>> entry : futureMap.entrySet()) {
+        for (Map.Entry<String, Future<ObjectNode>> entry : futureMap.entrySet()) {
             result.put(entry.getKey(), entry.getValue().get());
         }
         return result;
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/QueryResultAPIServlet.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/QueryResultAPIServlet.java
index 9994bc7..b250690 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/QueryResultAPIServlet.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/QueryResultAPIServlet.java
@@ -31,6 +31,7 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
 import org.apache.asterix.app.result.ResultReader;
 import org.apache.asterix.app.result.ResultUtil;
 import org.apache.asterix.common.exceptions.AsterixException;
@@ -42,12 +43,11 @@
 import org.apache.hyracks.api.dataset.ResultSetId;
 import org.apache.hyracks.api.job.JobId;
 import org.apache.hyracks.client.dataset.HyracksDataset;
-import org.json.JSONArray;
-import org.json.JSONObject;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 
 public class QueryResultAPIServlet extends HttpServlet {
     private static final long serialVersionUID = 1L;
-
     private static final Logger LOGGER = Logger.getLogger(QueryResultAPIServlet.class.getName());
 
     @Override
@@ -83,10 +83,11 @@
                     context.setAttribute(HYRACKS_DATASET_ATTR, hds);
                 }
             }
-            JSONObject handleObj = new JSONObject(strHandle);
-            JSONArray handle = handleObj.getJSONArray("handle");
-            JobId jobId = new JobId(handle.getLong(0));
-            ResultSetId rsId = new ResultSetId(handle.getLong(1));
+            ObjectMapper om = new ObjectMapper();
+            ObjectNode handleObj = (ObjectNode) om.readTree(strHandle);
+            ArrayNode handle = (ArrayNode) handleObj.get("handle");
+            JobId jobId = new JobId(handle.get(0).asLong());
+            ResultSetId rsId = new ResultSetId(handle.get(1).asLong());
 
             ResultReader resultReader = new ResultReader(hds);
             resultReader.open(jobId, rsId);
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/QueryServiceServlet.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/QueryServiceServlet.java
index 9da518a..a0454fd 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/QueryServiceServlet.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/QueryServiceServlet.java
@@ -37,6 +37,7 @@
 import javax.servlet.http.HttpServletResponse;
 
 import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.JsonMappingException;
 import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.ObjectMapper;
@@ -293,6 +294,7 @@
     private static SessionConfig createSessionConfig(RequestParameters param, PrintWriter resultWriter) {
         SessionConfig.ResultDecorator resultPrefix = new SessionConfig.ResultDecorator() {
             int resultNo = -1;
+
             @Override
             public AlgebricksAppendable append(AlgebricksAppendable app) throws AlgebricksException {
                 app.append("\t\"");
@@ -306,16 +308,24 @@
             }
         };
 
+
         SessionConfig.ResultDecorator resultPostfix = (AlgebricksAppendable app) -> app.append("\t,\n");
 
-        SessionConfig.ResultDecorator handlePrefix = (AlgebricksAppendable app) -> app.append("\t\"").append
-                (ResultFields.HANDLE.str()).append("\": ");
+        SessionConfig.ResultDecorator handlePrefix = new SessionConfig.ResultDecorator() {
+            @Override
+            public AlgebricksAppendable append(AlgebricksAppendable app) throws AlgebricksException {
+                app.append("\t\"");
+                app.append(ResultFields.HANDLE.str());
+                app.append("\": ");
+                return app;
+            }
+        };
 
         SessionConfig.ResultDecorator handlePostfix = (AlgebricksAppendable app) -> app.append(",\n");
 
         SessionConfig.OutputFormat format = getFormat(param.format);
-        SessionConfig sessionConfig = new SessionConfig(resultWriter, format, resultPrefix, resultPostfix,
-                handlePrefix, handlePostfix);
+        SessionConfig sessionConfig = new SessionConfig(resultWriter, format, resultPrefix, resultPostfix, handlePrefix,
+                handlePostfix);
         sessionConfig.set(SessionConfig.FORMAT_WRAPPER_ARRAY, true);
         sessionConfig.set(SessionConfig.FORMAT_INDENT_JSON, param.pretty);
         sessionConfig.set(SessionConfig.FORMAT_QUOTE_RECORD,
@@ -376,7 +386,7 @@
         printField(pw, ResultFields.STATUS.str(), rs.str());
     }
 
-    private static void printError(PrintWriter pw, Throwable e) {
+    private static void printError(PrintWriter pw, Throwable e) throws JsonProcessingException {
         Throwable rootCause = ResultUtil.getRootCause(e);
         if (rootCause == null) {
             rootCause = e;
@@ -386,16 +396,10 @@
         pw.print(ResultFields.ERRORS.str());
         pw.print("\": [{ \n");
         printField(pw, ErrorField.CODE.str(), "1");
+
         final String msg = rootCause.getMessage();
         printField(pw, ErrorField.MSG.str(), JSONUtil.escape(msg != null ? msg : rootCause.getClass().getSimpleName()),
                 addStack);
-        if (addStack) {
-            StringWriter sw = new StringWriter();
-            PrintWriter stackWriter = new PrintWriter(sw);
-            LOGGER.info(stackWriter.toString());
-            stackWriter.close();
-            printField(pw, ErrorField.STACK.str(), JSONUtil.escape(sw.toString()), false);
-        }
         pw.print("\t}],\n");
     }
 
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/QueryStatusAPIServlet.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/QueryStatusAPIServlet.java
index 9555e11..6d1b1b2 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/QueryStatusAPIServlet.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/QueryStatusAPIServlet.java
@@ -29,14 +29,15 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
 import org.apache.asterix.app.result.ResultReader;
 import org.apache.hyracks.api.client.IHyracksClientConnection;
 import org.apache.hyracks.api.dataset.IHyracksDataset;
 import org.apache.hyracks.api.dataset.ResultSetId;
 import org.apache.hyracks.api.job.JobId;
 import org.apache.hyracks.client.dataset.HyracksDataset;
-import org.json.JSONArray;
-import org.json.JSONObject;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 
 public class QueryStatusAPIServlet extends HttpServlet {
     private static final long serialVersionUID = 1L;
@@ -61,10 +62,11 @@
                     context.setAttribute(HYRACKS_DATASET_ATTR, hds);
                 }
             }
-            JSONObject handleObj = new JSONObject(strHandle);
-            JSONArray handle = handleObj.getJSONArray("handle");
-            JobId jobId = new JobId(handle.getLong(0));
-            ResultSetId rsId = new ResultSetId(handle.getLong(1));
+            ObjectMapper om = new ObjectMapper();
+            JsonNode handleObj = om.readTree(strHandle);
+            JsonNode handle = handleObj.get("handle");
+            JobId jobId = new JobId(handle.get(0).asLong());
+            ResultSetId rsId = new ResultSetId(handle.get(1).asLong());
 
             /* TODO(madhusudancs): We need to find a way to LOSSLESS_JSON serialize default format obtained from
              * metadataProvider in the AQLTranslator and store it as part of the result handle.
@@ -72,7 +74,7 @@
             ResultReader resultReader = new ResultReader(hds);
             resultReader.open(jobId, rsId);
 
-            JSONObject jsonResponse = new JSONObject();
+            ObjectNode jsonResponse = om.createObjectNode();
             String status;
             switch (resultReader.getStatus()) {
                 case RUNNING:
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/QueryWebInterfaceServlet.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/QueryWebInterfaceServlet.java
index 383d8fd..d3e5556 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/QueryWebInterfaceServlet.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/QueryWebInterfaceServlet.java
@@ -30,12 +30,13 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 import org.apache.asterix.common.config.ExternalProperties;
 import org.apache.asterix.runtime.util.AppContextInfo;
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.codehaus.jettison.json.JSONObject;
 
 public class QueryWebInterfaceServlet extends HttpServlet {
     private static final long serialVersionUID = 1L;
@@ -110,7 +111,8 @@
         response.setCharacterEncoding("utf-8");
         response.setContentType("application/json");
         ExternalProperties externalProperties = AppContextInfo.INSTANCE.getExternalProperties();
-        JSONObject obj = new JSONObject();
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode obj = om.createObjectNode();
         try {
             PrintWriter out = response.getWriter();
             obj.put("api_port", String.valueOf(externalProperties.getAPIServerPort()));
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/RESTAPIServlet.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/RESTAPIServlet.java
index 4a06590..dd030b0 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/RESTAPIServlet.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/RESTAPIServlet.java
@@ -33,6 +33,7 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
 import org.apache.asterix.app.result.ResultReader;
 import org.apache.asterix.app.result.ResultUtil;
 import org.apache.asterix.app.translator.QueryTranslator;
@@ -53,7 +54,7 @@
 import org.apache.hyracks.api.client.IHyracksClientConnection;
 import org.apache.hyracks.api.dataset.IHyracksDataset;
 import org.apache.hyracks.client.dataset.HyracksDataset;
-import org.json.JSONObject;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 
 abstract class RESTAPIServlet extends HttpServlet {
     private static final long serialVersionUID = 1L;
@@ -211,9 +212,9 @@
         } catch (AsterixException | TokenMgrError | org.apache.asterix.aqlplus.parser.TokenMgrError pe) {
             GlobalConfig.ASTERIX_LOGGER.log(Level.SEVERE, pe.getMessage(), pe);
             String errorMessage = ResultUtil.buildParseExceptionMessage(pe, query);
-            JSONObject errorResp =
+            ObjectNode errorResp =
                     ResultUtil.getErrorResponse(2, errorMessage, "", ResultUtil.extractFullStackTrace(pe));
-            sessionConfig.out().write(errorResp.toString());
+            sessionConfig.out().write(new ObjectMapper().writeValueAsString(errorResp));
             response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
         } catch (Exception e) {
             GlobalConfig.ASTERIX_LOGGER.log(Level.SEVERE, e.getMessage(), e);
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/ShutdownAPIServlet.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/ShutdownAPIServlet.java
index d99b379..d07166e 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/ShutdownAPIServlet.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/ShutdownAPIServlet.java
@@ -31,11 +31,13 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
 import org.apache.asterix.common.config.GlobalConfig;
 import org.apache.asterix.runtime.util.ClusterStateManager;
 import org.apache.hyracks.api.client.IHyracksClientConnection;
-import org.json.JSONArray;
-import org.json.JSONObject;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 
 public class ShutdownAPIServlet extends HttpServlet {
     private static final long serialVersionUID = 1L;
@@ -62,25 +64,25 @@
         response.setContentType("application/json");
         response.setCharacterEncoding("utf-8");
         response.setStatus(HttpServletResponse.SC_ACCEPTED);
-        JSONObject jsonObject = new JSONObject();
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode jsonObject = om.createObjectNode();
         try {
             jsonObject.put("status", "SHUTTING_DOWN");
-            jsonObject.put("date", new Date());
-            JSONObject clusterState = ClusterStateManager.INSTANCE.getClusterStateDescription();
-            JSONArray ncs = clusterState.getJSONArray("ncs");
-            for (int i = 0; i < ncs.length(); i++) {
-                JSONObject nc = ncs.getJSONObject(i);
-                String node = nc.getString(NODE_ID_KEY);
-                JSONObject details = new JSONObject(hcc.getNodeDetailsJSON(node, false, true));
-                nc.put(PID, details.get(PID));
-                if (details.has(INI) && details.getJSONObject(INI).has(NCSERVICE_PID)) {
-                    nc.put(NCSERVICE_PID, details.getJSONObject(INI).getInt(NCSERVICE_PID));
+            jsonObject.putPOJO("date", new Date());
+            ObjectNode clusterState = ClusterStateManager.INSTANCE.getClusterStateDescription();
+            ArrayNode ncs = (ArrayNode) clusterState.get("ncs");
+            for (int i = 0; i < ncs.size(); i++) {
+                ObjectNode nc = (ObjectNode) ncs.get(i);
+                String node = nc.get(NODE_ID_KEY).asText();
+                ObjectNode details = (ObjectNode) om.readTree(hcc.getNodeDetailsJSON(node, false, true));
+                nc.set(PID, details.get(PID));
+                if (details.has(INI) && details.get(INI).has(NCSERVICE_PID)) {
+                    nc.put(NCSERVICE_PID, details.get(INI).get(NCSERVICE_PID).asInt());
                 }
             }
-            jsonObject.put("cluster", clusterState);
-
+            jsonObject.set("cluster", clusterState);
             final PrintWriter writer = response.getWriter();
-            writer.print(jsonObject.toString(4));
+            writer.print(om.writeValueAsString(jsonObject));
             writer.close();
         } catch (Exception e) {
             GlobalConfig.ASTERIX_LOGGER.log(Level.INFO, "Exception writing response", e);
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/VersionAPIServlet.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/VersionAPIServlet.java
index c1ce344..398a355 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/VersionAPIServlet.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/VersionAPIServlet.java
@@ -27,8 +27,9 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 import org.apache.asterix.runtime.util.AppContextInfo;
-import org.json.JSONObject;
 
 import static org.apache.asterix.api.http.servlet.ServletConstants.ASTERIX_BUILD_PROP_ATTR;
 
@@ -40,7 +41,11 @@
         ServletContext context = getServletContext();
         AppContextInfo props = (AppContextInfo) context.getAttribute(ASTERIX_BUILD_PROP_ATTR);
         Map<String, String> buildProperties = props.getBuildProperties().getAllProps();
-        JSONObject responseObject = new JSONObject(buildProperties);
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode responseObject = om.createObjectNode();
+        for (Map.Entry<String, String> e : buildProperties.entrySet()) {
+            responseObject.put(e.getKey(), e.getValue());
+        }
         response.setCharacterEncoding("utf-8");
         PrintWriter responseWriter = response.getWriter();
         responseWriter.write(responseObject.toString());
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/result/ResultPrinter.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/result/ResultPrinter.java
index 22034c3..5465fbd 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/result/ResultPrinter.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/result/ResultPrinter.java
@@ -24,6 +24,9 @@
 import java.io.StringWriter;
 import java.nio.ByteBuffer;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 import org.apache.asterix.common.utils.JSONUtil;
 import org.apache.asterix.om.types.ARecordType;
 import org.apache.asterix.translator.IStatementExecutor.Stats;
@@ -126,13 +129,20 @@
         if (conf.is(SessionConfig.FORMAT_HTML)) {
             conf.out().println("</pre>");
         }
+        conf.out().flush();
     }
 
-    private void printRecord(String result) {
+    private void displayRecord(String result) throws HyracksDataException {
+        ObjectMapper om = new ObjectMapper();
+        om.enable(SerializationFeature.INDENT_OUTPUT);
         String record = result;
         if (indentJSON) {
             // TODO(tillw): this is inefficient - do this during record generation
-            record = JSONUtil.indent(record, 2);
+            try {
+                record = om.writerWithDefaultPrettyPrinter().writeValueAsString(om.readValue(result, ObjectNode.class));
+            } catch (IOException e) {
+                throw new HyracksDataException(e);
+            }
         }
         if (conf.fmt() == SessionConfig.OutputFormat.CSV) {
             // TODO(tillw): this is inefficient as well
@@ -152,7 +162,7 @@
         printPrefix();
         // TODO(tillw) evil hack
         quoteRecord = true;
-        printRecord(record);
+        displayRecord(record);
         printPostfix();
     }
 
@@ -179,7 +189,11 @@
                     conf.out().print(", ");
                 }
                 notFirst = true;
-                printRecord(result);
+                try {
+                    displayRecord(result);
+                } catch (IOException e) {
+                    throw new HyracksDataException(e);
+                }
             }
             frameBuffer.clear();
         }
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/result/ResultUtil.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/result/ResultUtil.java
index 595c6ab..80b8ffe 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/result/ResultUtil.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/result/ResultUtil.java
@@ -33,6 +33,7 @@
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
 import org.apache.asterix.api.http.servlet.APIServlet;
 import org.apache.asterix.om.types.ARecordType;
 import org.apache.asterix.translator.IStatementExecutor.Stats;
@@ -42,9 +43,9 @@
 import org.apache.hyracks.algebricks.core.algebra.prettyprint.AlgebricksAppendable;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.log4j.Logger;
-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 ResultUtil {
     private static final Logger LOGGER = Logger.getLogger(ResultUtil.class.getName());
@@ -94,25 +95,21 @@
         }
     }
 
-    public static JSONObject getErrorResponse(int errorCode, String errorMessage, String errorSummary,
+    public static ObjectNode getErrorResponse(int errorCode, String errorMessage, String errorSummary,
             String errorStackTrace) {
-        JSONObject errorResp = new JSONObject();
-        JSONArray errorArray = new JSONArray();
-        errorArray.put(errorCode);
-        errorArray.put(errorMessage);
-        try {
-            errorResp.put("error-code", errorArray);
-            if (!"".equals(errorSummary)) {
-                errorResp.put("summary", errorSummary);
-            } else {
-                //parse exception
-                errorResp.put("summary", errorMessage);
-            }
-            errorResp.put("stacktrace", errorStackTrace);
-        } catch (JSONException e) {
-            LOGGER.warn("Failed to build the result's JSON object", e);
-            // TODO(madhusudancs): Figure out what to do when JSONException occurs while building the results.
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode errorResp = om.createObjectNode();
+        ArrayNode errorArray = om.createArrayNode();
+        errorArray.add(errorCode);
+        errorArray.add(errorMessage);
+        errorResp.set("error-code", errorArray);
+        if (!"".equals(errorSummary)) {
+            errorResp.put("summary", errorSummary);
+        } else {
+            //parse exception
+            errorResp.put("summary", errorMessage);
         }
+        errorResp.put("stacktrace", errorStackTrace);
         return errorResp;
     }
 
@@ -141,7 +138,7 @@
             errorCode = 4;
         }
 
-        JSONObject errorResp = ResultUtil.getErrorResponse(errorCode, extractErrorMessage(e), extractErrorSummary(e),
+        ObjectNode errorResp = ResultUtil.getErrorResponse(errorCode, extractErrorMessage(e), extractErrorSummary(e),
                 extractFullStackTrace(e));
         out.write(errorResp.toString());
     }
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java
index 906525c..593adb2 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java
@@ -40,6 +40,7 @@
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
 import org.apache.asterix.active.ActiveJobNotificationHandler;
 import org.apache.asterix.active.ActivityState;
 import org.apache.asterix.active.EntityId;
@@ -205,6 +206,9 @@
 import org.apache.hyracks.api.job.JobId;
 import org.apache.hyracks.api.job.JobSpecification;
 import org.apache.hyracks.storage.am.lsm.common.api.ILSMMergePolicyFactory;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+
+import com.fasterxml.jackson.databind.node.ObjectNode;
 
 import com.google.common.collect.Lists;
 
@@ -2589,15 +2593,15 @@
     private void handleQueryResult(MetadataProvider metadataProvider, IHyracksClientConnection hcc,
             IHyracksDataset hdc, JobSpecification jobSpec, ResultDelivery resultDelivery, Stats stats)
             throws Exception {
-        if (GlobalConfig.ASTERIX_LOGGER.isLoggable(Level.FINE)) {
-            GlobalConfig.ASTERIX_LOGGER.fine(jobSpec.toJSON().toString(1));
-        }
         JobId jobId = JobUtils.runJob(hcc, jobSpec, false);
 
+        ResultHandle hand;
         switch (resultDelivery) {
             case ASYNC:
-                ResultUtil.printResultHandle(new ResultHandle(jobId, metadataProvider.getResultSetId()), sessionConfig);
+                hand = new ResultHandle(jobId,metadataProvider.getResultSetId());
+                ResultUtil.printResultHandle(hand,sessionConfig);
                 hcc.waitForCompletion(jobId);
+                sessionConfig.out().flush();
                 break;
             case IMMEDIATE:
                 hcc.waitForCompletion(jobId);
@@ -2607,7 +2611,9 @@
                 break;
             case DEFERRED:
                 hcc.waitForCompletion(jobId);
-                ResultUtil.printResultHandle(new ResultHandle(jobId, metadataProvider.getResultSetId()), sessionConfig);
+                hand = new ResultHandle(jobId,metadataProvider.getResultSetId());
+                ResultUtil.printResultHandle(hand,sessionConfig);
+                sessionConfig.out().flush();
                 break;
             default:
                 break;
@@ -3237,4 +3243,4 @@
         }
         return recordNameTypesMap;
     }
-}
\ No newline at end of file
+}
diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/api/http/servlet/ConnectorAPIServletTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/api/http/servlet/ConnectorAPIServletTest.java
index fdcbad5..48d1c1c 100644
--- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/api/http/servlet/ConnectorAPIServletTest.java
+++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/api/http/servlet/ConnectorAPIServletTest.java
@@ -36,6 +36,7 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
 import org.apache.asterix.metadata.MetadataManager;
 import org.apache.asterix.metadata.MetadataTransactionContext;
 import org.apache.asterix.metadata.declared.MetadataProvider;
@@ -48,10 +49,10 @@
 import org.apache.hyracks.api.client.IHyracksClientConnection;
 import org.apache.hyracks.api.client.NodeControllerInfo;
 import org.apache.hyracks.api.comm.NetworkAddress;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 import org.apache.hyracks.api.io.FileSplit;
 import org.apache.hyracks.api.io.ManagedFileSplit;
-import org.json.JSONArray;
-import org.json.JSONObject;
 import org.json.JSONTokener;
 import org.junit.Assert;
 import org.junit.Test;
@@ -97,22 +98,21 @@
         servlet.doGet(mockRequest, mockResponse);
 
         // Constructs the actual response.
-        JSONTokener tokener = new JSONTokener(
-                new InputStreamReader(new ByteArrayInputStream(outputStream.toByteArray())));
-        JSONObject actualResponse = new JSONObject(tokener);
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode actualResponse = (ObjectNode) om.readTree(outputStream.toString());
 
         // Checks the temp-or-not, primary key, data type of the dataset.
-        boolean temp = actualResponse.getBoolean("temp");
+        boolean temp = actualResponse.get("temp").asBoolean();
         Assert.assertFalse(temp);
-        String primaryKey = actualResponse.getString("keys");
+        String primaryKey = actualResponse.get("keys").asText();
         Assert.assertEquals("DataverseName,DatasetName", primaryKey);
         ARecordType recordType = (ARecordType) JSONDeserializerForTypes
-                .convertFromJSON((JSONObject) actualResponse.get("type"));
+                .convertFromJSON((ObjectNode) actualResponse.get("type"));
         Assert.assertEquals(getMetadataRecordType("Metadata", "Dataset"), recordType);
 
         // Checks the correctness of results.
-        JSONArray splits = actualResponse.getJSONArray("splits");
-        String path = ((JSONObject) splits.get(0)).getString("path");
+        ArrayNode splits = (ArrayNode) actualResponse.get("splits");
+        String path = (splits.get(0)).get("path").asText();
         Assert.assertTrue(path.endsWith("Metadata/Dataset_idx_Dataset"));
 
         // Tears down the asterixdb cluster.
@@ -122,7 +122,8 @@
     @Test
     public void testFormResponseObject() throws Exception {
         ConnectorAPIServlet servlet = new ConnectorAPIServlet();
-        JSONObject actualResponse = new JSONObject();
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode actualResponse = om.createObjectNode();
         FileSplit[] splits = new FileSplit[2];
         splits[0] = new ManagedFileSplit("asterix_nc1", "foo1");
         splits[1] = new ManagedFileSplit("asterix_nc2", "foo2");
@@ -142,24 +143,24 @@
         // Calls ConnectorAPIServlet.formResponseObject.
         nodeMap.put("asterix_nc1", mockInfo1);
         nodeMap.put("asterix_nc2", mockInfo2);
-        PA.invokeMethod(servlet, "formResponseObject(" + JSONObject.class.getName() + ", " + FileSplit.class.getName()
+        PA.invokeMethod(servlet, "formResponseObject(" + ObjectNode.class.getName() + ", " + FileSplit.class.getName()
                 + "[], " + ARecordType.class.getName() + ", " + String.class.getName() + ", boolean, " + Map.class
                         .getName() + ")", actualResponse, splits, recordType, primaryKey, true, nodeMap);
         // Constructs expected response.
-        JSONObject expectedResponse = new JSONObject();
+        ObjectNode expectedResponse = om.createObjectNode();
         expectedResponse.put("temp", true);
         expectedResponse.put("keys", primaryKey);
-        expectedResponse.put("type", recordType.toJSON());
-        JSONArray splitsArray = new JSONArray();
-        JSONObject element1 = new JSONObject();
+        expectedResponse.set("type", recordType.toJSON());
+        ArrayNode splitsArray = om.createArrayNode();
+        ObjectNode element1 = om.createObjectNode();
         element1.put("ip", "127.0.0.1");
         element1.put("path", splits[0].getPath());
-        JSONObject element2 = new JSONObject();
+        ObjectNode element2 = om.createObjectNode();
         element2.put("ip", "127.0.0.2");
         element2.put("path", splits[1].getPath());
-        splitsArray.put(element1);
-        splitsArray.put(element2);
-        expectedResponse.put("splits", splitsArray);
+        splitsArray.add(element1);
+        splitsArray.add(element2);
+        expectedResponse.set("splits", splitsArray);
 
         // Checks results.
         Assert.assertEquals(actualResponse.toString(), expectedResponse.toString());
diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/api/http/servlet/VersionAPIServletTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/api/http/servlet/VersionAPIServletTest.java
index 2209fc5..da0ec0c 100644
--- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/api/http/servlet/VersionAPIServletTest.java
+++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/api/http/servlet/VersionAPIServletTest.java
@@ -37,12 +37,12 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
 import org.apache.asterix.common.config.BuildProperties;
 import org.apache.asterix.runtime.util.AppContextInfo;
 import org.apache.asterix.test.runtime.SqlppExecutionTest;
 import org.apache.hyracks.api.client.IHyracksClientConnection;
-import org.json.JSONObject;
-import org.json.JSONTokener;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -103,10 +103,13 @@
         servlet.doGet(mockRequest, mockResponse);
 
         // Constructs the actual response.
-        JSONTokener tokener = new JSONTokener(
-                new InputStreamReader(new ByteArrayInputStream(outputStream.toByteArray())));
-        JSONObject actualResponse = new JSONObject(tokener);
-        JSONObject expectedResponse = new JSONObject(propMap);
+
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode actualResponse = (ObjectNode) om.readTree(outputStream.toByteArray());
+        ObjectNode expectedResponse = om.createObjectNode();
+        for (Map.Entry<String, String> e : propMap.entrySet()) {
+            expectedResponse.put(e.getKey(), e.getValue());
+        }
 
         // Checks the response contains all the expected keys.
         Assert.assertEquals(actualResponse.toString(), expectedResponse.toString());
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/types/any-object/any-object.2.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/types/any-object/any-object.2.query.sqlpp
index 91a980e..afaa5b1 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/types/any-object/any-object.2.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/types/any-object/any-object.2.query.sqlpp
@@ -17,6 +17,4 @@
  * under the License.
  */
 
-select element x
-from Metadata.Datatype as x
-order by x.DataverseName, x.DatatypeName;
+select element x from Metadata.Datatype as x;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1/cluster_state_1.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1/cluster_state_1.1.adm
index 15b1baa..746b75d 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1/cluster_state_1.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1/cluster_state_1.1.adm
@@ -1,129 +1,162 @@
 {
-    "cc": {
-        "configUri": "http://127.0.0.1:19002/admin/cluster/cc/config",
-        "statsUri": "http://127.0.0.1:19002/admin/cluster/cc/stats",
-        "threadDumpUri": "http://127.0.0.1:19002/admin/cluster/cc/threaddump"
+  "cc" : {
+    "configUri" : "http://127.0.0.1:19002/admin/cluster/cc/config",
+    "statsUri" : "http://127.0.0.1:19002/admin/cluster/cc/stats",
+    "threadDumpUri" : "http://127.0.0.1:19002/admin/cluster/cc/threaddump"
+  },
+  "config" : {
+    "api.port" : 19002,
+    "cluster.partitions" : {
+      "0" : {
+        "partitionId" : 0,
+        "nodeId" : "asterix_nc1",
+        "activeNodeId" : "asterix_nc1",
+        "active" : true,
+        "iodeviceNum" : 0
+      },
+      "1" : {
+        "partitionId" : 1,
+        "nodeId" : "asterix_nc1",
+        "activeNodeId" : "asterix_nc1",
+        "active" : true,
+        "iodeviceNum" : 1
+      },
+      "2" : {
+        "partitionId" : 2,
+        "nodeId" : "asterix_nc2",
+        "activeNodeId" : "asterix_nc2",
+        "active" : true,
+        "iodeviceNum" : 0
+      },
+      "3" : {
+        "partitionId" : 3,
+        "nodeId" : "asterix_nc2",
+        "activeNodeId" : "asterix_nc2",
+        "active" : true,
+        "iodeviceNum" : 1
+      }
     },
-    "config": {
-        "api.port": 19002,
-        "cluster.partitions": {
-            "0": "ID:0, Original Node: asterix_nc1, IODevice: 0, Active Node: asterix_nc1",
-            "1": "ID:1, Original Node: asterix_nc1, IODevice: 1, Active Node: asterix_nc1",
-            "2": "ID:2, Original Node: asterix_nc2, IODevice: 0, Active Node: asterix_nc2",
-            "3": "ID:3, Original Node: asterix_nc2, IODevice: 1, Active Node: asterix_nc2"
-        },
-        "compiler.framesize": 32768,
-        "compiler.groupmemory": 163840,
-        "compiler.joinmemory": 262144,
-        "compiler.parallelism": 0,
-        "compiler.pregelix.home": "~/pregelix",
-        "compiler.sortmemory": 327680,
-        "core.dump.paths": {},
-        "feed.central.manager.port": 4500,
-        "feed.max.threshold.period": 5,
-        "feed.memory.available.wait.timeout": 10,
-        "feed.memory.global.budget": 67108864,
-        "feed.pending.work.threshold": 50,
-        "feed.port": 19003,
-        "instance.name": null,
-        "log.level": "INFO",
-        "max.wait.active.cluster": 60,
-        "metadata.callback.port": 0,
-        "metadata.node": "asterix_nc1",
-        "metadata.partition": "ID:0, Original Node: asterix_nc1, IODevice: 0, Active Node: asterix_nc1",
-        "metadata.port": 0,
-        "metadata.registration.timeout.secs": 60,
-        "node.partitions": {
-            "asterix_nc1": [
-                "ID:0, Original Node: asterix_nc1, IODevice: 0, Active Node: asterix_nc1",
-                "ID:1, Original Node: asterix_nc1, IODevice: 1, Active Node: asterix_nc1"
-            ],
-            "asterix_nc2": [
-                "ID:2, Original Node: asterix_nc2, IODevice: 0, Active Node: asterix_nc2",
-                "ID:3, Original Node: asterix_nc2, IODevice: 1, Active Node: asterix_nc2"
-            ]
-        },
-        "node.stores": {
-            "asterix_nc1": [
-                "iodevice0",
-                "iodevice1"
-            ],
-            "asterix_nc2": [
-                "iodevice0",
-                "iodevice1"
-            ]
-        },
-        "plot.activate": false,
-        "storage.buffercache.maxopenfiles": 2147483647,
-        "storage.buffercache.pagesize": 32768,
-        "storage.buffercache.size": 50331648,
-        "storage.lsm.bloomfilter.falsepositiverate": 0.01,
-        "storage.memorycomponent.globalbudget": 536870912,
-        "storage.memorycomponent.numcomponents": 2,
-        "storage.memorycomponent.numpages": 8,
-        "storage.memorycomponent.pagesize": 131072,
-        "storage.metadata.memorycomponent.numpages": 256,
-        "transaction.log.dirs": {
-            "asterix_nc1": "target/txnLogDir/asterix_nc1",
-            "asterix_nc2": "target/txnLogDir/asterix_nc2"
-        },
-        "txn.commitprofiler.reportinterval": 5,
-        "txn.job.recovery.memorysize": 67108864,
-        "txn.lock.escalationthreshold": 1000,
-        "txn.lock.shrinktimer": 5000,
-        "txn.lock.timeout.sweepthreshold": 10000,
-        "txn.lock.timeout.waitthreshold": 60000,
-        "txn.log.buffer.numpages": 8,
-        "txn.log.buffer.pagesize": 131072,
-        "txn.log.checkpoint.history": 0,
-        "txn.log.checkpoint.lsnthreshold": 67108864,
-        "txn.log.checkpoint.pollfrequency": 120,
-        "txn.log.partitionsize": 268435456,
-        "web.port": 19001,
-        "web.queryinterface.port": 19006,
-        "web.secondary.port": 19005
+    "compiler.framesize" : 32768,
+    "compiler.groupmemory" : 163840,
+    "compiler.joinmemory" : 262144,
+    "compiler.parallelism" : 0,
+    "compiler.pregelix.home" : "~/pregelix",
+    "compiler.sortmemory" : 327680,
+    "core.dump.paths" : { },
+    "feed.central.manager.port" : 4500,
+    "feed.max.threshold.period" : 5,
+    "feed.memory.available.wait.timeout" : 10,
+    "feed.memory.global.budget" : 67108864,
+    "feed.pending.work.threshold" : 50,
+    "feed.port" : 19003,
+    "instance.name" : null,
+    "log.level" : "INFO",
+    "max.wait.active.cluster" : 60,
+    "metadata.callback.port" : 0,
+    "metadata.node" : "asterix_nc1",
+    "metadata.partition" : {
+      "partitionId" : 0,
+      "nodeId" : "asterix_nc1",
+      "activeNodeId" : "asterix_nc1",
+      "active" : true,
+      "iodeviceNum" : 0
     },
-    "diagnosticsUri": "http://127.0.0.1:19002/admin/diagnostics",
-    "fullShutdownUri": "http://127.0.0.1:19002/admin/shutdown?all=true",
-    "metadata_node": "asterix_nc1",
-    "ncs": [
-        {
-            "configUri": "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/config",
-            "node_id": "asterix_nc1",
-            "partitions": [
-                {
-                    "active": true,
-                    "partition_id": "partition_0"
-                },
-                {
-                    "active": true,
-                    "partition_id": "partition_1"
-                }
-            ],
-            "state": "ACTIVE",
-            "statsUri": "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/stats",
-            "threadDumpUri": "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/threaddump"
-        },
-        {
-            "configUri": "http://127.0.0.1:19002/admin/cluster/node/asterix_nc2/config",
-            "node_id": "asterix_nc2",
-            "partitions": [
-                {
-                    "active": true,
-                    "partition_id": "partition_2"
-                },
-                {
-                    "active": true,
-                    "partition_id": "partition_3"
-                }
-            ],
-            "state": "ACTIVE",
-            "statsUri": "http://127.0.0.1:19002/admin/cluster/node/asterix_nc2/stats",
-            "threadDumpUri": "http://127.0.0.1:19002/admin/cluster/node/asterix_nc2/threaddump"
-        }
-    ],
-    "replicationUri": "http://127.0.0.1:19002/admin/cluster/replication",
-    "shutdownUri": "http://127.0.0.1:19002/admin/shutdown",
-    "state": "ACTIVE",
-    "versionUri": "http://127.0.0.1:19002/admin/version"
+    "metadata.port" : 0,
+    "metadata.registration.timeout.secs" : 60,
+    "node.partitions" : {
+      "asterix_nc1" : [ {
+        "partitionId" : 0,
+        "nodeId" : "asterix_nc1",
+        "activeNodeId" : "asterix_nc1",
+        "active" : true,
+        "iodeviceNum" : 0
+      }, {
+        "partitionId" : 1,
+        "nodeId" : "asterix_nc1",
+        "activeNodeId" : "asterix_nc1",
+        "active" : true,
+        "iodeviceNum" : 1
+      } ],
+      "asterix_nc2" : [ {
+        "partitionId" : 2,
+        "nodeId" : "asterix_nc2",
+        "activeNodeId" : "asterix_nc2",
+        "active" : true,
+        "iodeviceNum" : 0
+      }, {
+        "partitionId" : 3,
+        "nodeId" : "asterix_nc2",
+        "activeNodeId" : "asterix_nc2",
+        "active" : true,
+        "iodeviceNum" : 1
+      } ]
+    },
+    "node.stores" : {
+      "asterix_nc1" : [ "iodevice0", "iodevice1" ],
+      "asterix_nc2" : [ "iodevice0", "iodevice1" ]
+    },
+    "plot.activate" : false,
+    "storage.buffercache.maxopenfiles" : 2147483647,
+    "storage.buffercache.pagesize" : 32768,
+    "storage.buffercache.size" : 50331648,
+    "storage.lsm.bloomfilter.falsepositiverate" : 0.01,
+    "storage.memorycomponent.globalbudget" : 536870912,
+    "storage.memorycomponent.numcomponents" : 2,
+    "storage.memorycomponent.numpages" : 8,
+    "storage.memorycomponent.pagesize" : 131072,
+    "storage.metadata.memorycomponent.numpages" : 256,
+    "transaction.log.dirs" : {
+      "asterix_nc1" : "target/txnLogDir/asterix_nc1",
+      "asterix_nc2" : "target/txnLogDir/asterix_nc2"
+    },
+    "txn.commitprofiler.reportinterval" : 5,
+    "txn.job.recovery.memorysize" : 67108864,
+    "txn.lock.escalationthreshold" : 1000,
+    "txn.lock.shrinktimer" : 5000,
+    "txn.lock.timeout.sweepthreshold" : 10000,
+    "txn.lock.timeout.waitthreshold" : 60000,
+    "txn.log.buffer.numpages" : 8,
+    "txn.log.buffer.pagesize" : 131072,
+    "txn.log.checkpoint.history" : 0,
+    "txn.log.checkpoint.lsnthreshold" : 67108864,
+    "txn.log.checkpoint.pollfrequency" : 120,
+    "txn.log.partitionsize" : 268435456,
+    "web.port" : 19001,
+    "web.queryinterface.port" : 19006,
+    "web.secondary.port" : 19005
+  },
+  "diagnosticsUri" : "http://127.0.0.1:19002/admin/diagnostics",
+  "fullShutdownUri" : "http://127.0.0.1:19002/admin/shutdown?all=true",
+  "metadata_node" : "asterix_nc1",
+  "ncs" : [ {
+    "configUri" : "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/config",
+    "node_id" : "asterix_nc1",
+    "partitions" : [ {
+      "active" : true,
+      "partition_id" : "partition_0"
+    }, {
+      "active" : true,
+      "partition_id" : "partition_1"
+    } ],
+    "state" : "ACTIVE",
+    "statsUri" : "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/stats",
+    "threadDumpUri" : "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/threaddump"
+  }, {
+    "configUri" : "http://127.0.0.1:19002/admin/cluster/node/asterix_nc2/config",
+    "node_id" : "asterix_nc2",
+    "partitions" : [ {
+      "active" : true,
+      "partition_id" : "partition_2"
+    }, {
+      "active" : true,
+      "partition_id" : "partition_3"
+    } ],
+    "state" : "ACTIVE",
+    "statsUri" : "http://127.0.0.1:19002/admin/cluster/node/asterix_nc2/stats",
+    "threadDumpUri" : "http://127.0.0.1:19002/admin/cluster/node/asterix_nc2/threaddump"
+  } ],
+  "replicationUri" : "http://127.0.0.1:19002/admin/cluster/replication",
+  "shutdownUri" : "http://127.0.0.1:19002/admin/shutdown",
+  "state" : "ACTIVE",
+  "versionUri" : "http://127.0.0.1:19002/admin/version"
 }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_full/cluster_state_1_full.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_full/cluster_state_1_full.1.adm
index 11e964c..7818a58 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_full/cluster_state_1_full.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_full/cluster_state_1_full.1.adm
@@ -1,129 +1,162 @@
 {
-    "cc": {
-        "configUri": "http://127.0.0.1:19002/admin/cluster/cc/config",
-        "statsUri": "http://127.0.0.1:19002/admin/cluster/cc/stats",
-        "threadDumpUri": "http://127.0.0.1:19002/admin/cluster/cc/threaddump"
+  "cc" : {
+    "configUri" : "http://127.0.0.1:19002/admin/cluster/cc/config",
+    "statsUri" : "http://127.0.0.1:19002/admin/cluster/cc/stats",
+    "threadDumpUri" : "http://127.0.0.1:19002/admin/cluster/cc/threaddump"
+  },
+  "config" : {
+    "api.port" : 19002,
+    "cluster.partitions" : {
+      "0" : {
+        "partitionId" : 0,
+        "nodeId" : "asterix_nc1",
+        "activeNodeId" : "asterix_nc1",
+        "active" : true,
+        "iodeviceNum" : 0
+      },
+      "1" : {
+        "partitionId" : 1,
+        "nodeId" : "asterix_nc1",
+        "activeNodeId" : "asterix_nc1",
+        "active" : true,
+        "iodeviceNum" : 1
+      },
+      "2" : {
+        "partitionId" : 2,
+        "nodeId" : "asterix_nc2",
+        "activeNodeId" : "asterix_nc2",
+        "active" : true,
+        "iodeviceNum" : 0
+      },
+      "3" : {
+        "partitionId" : 3,
+        "nodeId" : "asterix_nc2",
+        "activeNodeId" : "asterix_nc2",
+        "active" : true,
+        "iodeviceNum" : 1
+      }
     },
-    "config": {
-        "api.port": 19002,
-        "cluster.partitions": {
-            "0": "ID:0, Original Node: asterix_nc1, IODevice: 0, Active Node: asterix_nc1",
-            "1": "ID:1, Original Node: asterix_nc1, IODevice: 1, Active Node: asterix_nc1",
-            "2": "ID:2, Original Node: asterix_nc2, IODevice: 0, Active Node: asterix_nc2",
-            "3": "ID:3, Original Node: asterix_nc2, IODevice: 1, Active Node: asterix_nc2"
-        },
-        "compiler.framesize": 32768,
-        "compiler.groupmemory": 163840,
-        "compiler.joinmemory": 262144,
-        "compiler.parallelism": -1,
-        "compiler.pregelix.home": "~/pregelix",
-        "compiler.sortmemory": 327680,
-        "core.dump.paths": {},
-        "feed.central.manager.port": 4500,
-        "feed.max.threshold.period": 5,
-        "feed.memory.available.wait.timeout": 10,
-        "feed.memory.global.budget": 67108864,
-        "feed.pending.work.threshold": 50,
-        "feed.port": 19003,
-        "instance.name": null,
-        "log.level": "INFO",
-        "max.wait.active.cluster": 60,
-        "metadata.callback.port": 0,
-        "metadata.node": "asterix_nc1",
-        "metadata.partition": "ID:0, Original Node: asterix_nc1, IODevice: 0, Active Node: asterix_nc1",
-        "metadata.port": 0,
-        "metadata.registration.timeout.secs": 60,
-        "node.partitions": {
-            "asterix_nc1": [
-                "ID:0, Original Node: asterix_nc1, IODevice: 0, Active Node: asterix_nc1",
-                "ID:1, Original Node: asterix_nc1, IODevice: 1, Active Node: asterix_nc1"
-            ],
-            "asterix_nc2": [
-                "ID:2, Original Node: asterix_nc2, IODevice: 0, Active Node: asterix_nc2",
-                "ID:3, Original Node: asterix_nc2, IODevice: 1, Active Node: asterix_nc2"
-            ]
-        },
-        "node.stores": {
-            "asterix_nc1": [
-                "iodevice0",
-                "iodevice1"
-            ],
-            "asterix_nc2": [
-                "iodevice0",
-                "iodevice1"
-            ]
-        },
-        "plot.activate": false,
-        "storage.buffercache.maxopenfiles": 2147483647,
-        "storage.buffercache.pagesize": 32768,
-        "storage.buffercache.size": 50331648,
-        "storage.lsm.bloomfilter.falsepositiverate": 0.01,
-        "storage.memorycomponent.globalbudget": 536870912,
-        "storage.memorycomponent.numcomponents": 2,
-        "storage.memorycomponent.numpages": 8,
-        "storage.memorycomponent.pagesize": 131072,
-        "storage.metadata.memorycomponent.numpages": 256,
-        "transaction.log.dirs": {
-            "asterix_nc1": "target/txnLogDir/asterix_nc1",
-            "asterix_nc2": "target/txnLogDir/asterix_nc2"
-        },
-        "txn.commitprofiler.reportinterval": 5,
-        "txn.job.recovery.memorysize": 67108864,
-        "txn.lock.escalationthreshold": 1000,
-        "txn.lock.shrinktimer": 5000,
-        "txn.lock.timeout.sweepthreshold": 10000,
-        "txn.lock.timeout.waitthreshold": 60000,
-        "txn.log.buffer.numpages": 8,
-        "txn.log.buffer.pagesize": 131072,
-        "txn.log.checkpoint.history": 0,
-        "txn.log.checkpoint.lsnthreshold": 67108864,
-        "txn.log.checkpoint.pollfrequency": 120,
-        "txn.log.partitionsize": 268435456,
-        "web.port": 19001,
-        "web.queryinterface.port": 19006,
-        "web.secondary.port": 19005
+    "compiler.framesize" : 32768,
+    "compiler.groupmemory" : 163840,
+    "compiler.joinmemory" : 262144,
+    "compiler.parallelism" : -1,
+    "compiler.pregelix.home" : "~/pregelix",
+    "compiler.sortmemory" : 327680,
+    "core.dump.paths" : { },
+    "feed.central.manager.port" : 4500,
+    "feed.max.threshold.period" : 5,
+    "feed.memory.available.wait.timeout" : 10,
+    "feed.memory.global.budget" : 67108864,
+    "feed.pending.work.threshold" : 50,
+    "feed.port" : 19003,
+    "instance.name" : null,
+    "log.level" : "INFO",
+    "max.wait.active.cluster" : 60,
+    "metadata.callback.port" : 0,
+    "metadata.node" : "asterix_nc1",
+    "metadata.partition" : {
+      "partitionId" : 0,
+      "nodeId" : "asterix_nc1",
+      "activeNodeId" : "asterix_nc1",
+      "active" : true,
+      "iodeviceNum" : 0
     },
-    "diagnosticsUri": "http://127.0.0.1:19002/admin/diagnostics",
-    "fullShutdownUri": "http://127.0.0.1:19002/admin/shutdown?all=true",
-    "metadata_node": "asterix_nc1",
-    "ncs": [
-        {
-            "configUri": "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/config",
-            "node_id": "asterix_nc1",
-            "partitions": [
-                {
-                    "active": true,
-                    "partition_id": "partition_0"
-                },
-                {
-                    "active": true,
-                    "partition_id": "partition_1"
-                }
-            ],
-            "state": "ACTIVE",
-            "statsUri": "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/stats",
-            "threadDumpUri": "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/threaddump"
-        },
-        {
-            "configUri": "http://127.0.0.1:19002/admin/cluster/node/asterix_nc2/config",
-            "node_id": "asterix_nc2",
-            "partitions": [
-                {
-                    "active": true,
-                    "partition_id": "partition_2"
-                },
-                {
-                    "active": true,
-                    "partition_id": "partition_3"
-                }
-            ],
-            "state": "ACTIVE",
-            "statsUri": "http://127.0.0.1:19002/admin/cluster/node/asterix_nc2/stats",
-            "threadDumpUri": "http://127.0.0.1:19002/admin/cluster/node/asterix_nc2/threaddump"
-        }
-    ],
-    "replicationUri": "http://127.0.0.1:19002/admin/cluster/replication",
-    "shutdownUri": "http://127.0.0.1:19002/admin/shutdown",
-    "state": "ACTIVE",
-    "versionUri": "http://127.0.0.1:19002/admin/version"
+    "metadata.port" : 0,
+    "metadata.registration.timeout.secs" : 60,
+    "node.partitions" : {
+      "asterix_nc1" : [ {
+        "partitionId" : 0,
+        "nodeId" : "asterix_nc1",
+        "activeNodeId" : "asterix_nc1",
+        "active" : true,
+        "iodeviceNum" : 0
+      }, {
+        "partitionId" : 1,
+        "nodeId" : "asterix_nc1",
+        "activeNodeId" : "asterix_nc1",
+        "active" : true,
+        "iodeviceNum" : 1
+      } ],
+      "asterix_nc2" : [ {
+        "partitionId" : 2,
+        "nodeId" : "asterix_nc2",
+        "activeNodeId" : "asterix_nc2",
+        "active" : true,
+        "iodeviceNum" : 0
+      }, {
+        "partitionId" : 3,
+        "nodeId" : "asterix_nc2",
+        "activeNodeId" : "asterix_nc2",
+        "active" : true,
+        "iodeviceNum" : 1
+      } ]
+    },
+    "node.stores" : {
+      "asterix_nc1" : [ "iodevice0", "iodevice1" ],
+      "asterix_nc2" : [ "iodevice0", "iodevice1" ]
+    },
+    "plot.activate" : false,
+    "storage.buffercache.maxopenfiles" : 2147483647,
+    "storage.buffercache.pagesize" : 32768,
+    "storage.buffercache.size" : 50331648,
+    "storage.lsm.bloomfilter.falsepositiverate" : 0.01,
+    "storage.memorycomponent.globalbudget" : 536870912,
+    "storage.memorycomponent.numcomponents" : 2,
+    "storage.memorycomponent.numpages" : 8,
+    "storage.memorycomponent.pagesize" : 131072,
+    "storage.metadata.memorycomponent.numpages" : 256,
+    "transaction.log.dirs" : {
+      "asterix_nc1" : "target/txnLogDir/asterix_nc1",
+      "asterix_nc2" : "target/txnLogDir/asterix_nc2"
+    },
+    "txn.commitprofiler.reportinterval" : 5,
+    "txn.job.recovery.memorysize" : 67108864,
+    "txn.lock.escalationthreshold" : 1000,
+    "txn.lock.shrinktimer" : 5000,
+    "txn.lock.timeout.sweepthreshold" : 10000,
+    "txn.lock.timeout.waitthreshold" : 60000,
+    "txn.log.buffer.numpages" : 8,
+    "txn.log.buffer.pagesize" : 131072,
+    "txn.log.checkpoint.history" : 0,
+    "txn.log.checkpoint.lsnthreshold" : 67108864,
+    "txn.log.checkpoint.pollfrequency" : 120,
+    "txn.log.partitionsize" : 268435456,
+    "web.port" : 19001,
+    "web.queryinterface.port" : 19006,
+    "web.secondary.port" : 19005
+  },
+  "diagnosticsUri" : "http://127.0.0.1:19002/admin/diagnostics",
+  "fullShutdownUri" : "http://127.0.0.1:19002/admin/shutdown?all=true",
+  "metadata_node" : "asterix_nc1",
+  "ncs" : [ {
+    "configUri" : "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/config",
+    "node_id" : "asterix_nc1",
+    "partitions" : [ {
+      "active" : true,
+      "partition_id" : "partition_0"
+    }, {
+      "active" : true,
+      "partition_id" : "partition_1"
+    } ],
+    "state" : "ACTIVE",
+    "statsUri" : "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/stats",
+    "threadDumpUri" : "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/threaddump"
+  }, {
+    "configUri" : "http://127.0.0.1:19002/admin/cluster/node/asterix_nc2/config",
+    "node_id" : "asterix_nc2",
+    "partitions" : [ {
+      "active" : true,
+      "partition_id" : "partition_2"
+    }, {
+      "active" : true,
+      "partition_id" : "partition_3"
+    } ],
+    "state" : "ACTIVE",
+    "statsUri" : "http://127.0.0.1:19002/admin/cluster/node/asterix_nc2/stats",
+    "threadDumpUri" : "http://127.0.0.1:19002/admin/cluster/node/asterix_nc2/threaddump"
+  } ],
+  "replicationUri" : "http://127.0.0.1:19002/admin/cluster/replication",
+  "shutdownUri" : "http://127.0.0.1:19002/admin/shutdown",
+  "state" : "ACTIVE",
+  "versionUri" : "http://127.0.0.1:19002/admin/version"
 }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_less/cluster_state_1_less.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_less/cluster_state_1_less.1.adm
index 83f18f1..71d6f8a 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_less/cluster_state_1_less.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_less/cluster_state_1_less.1.adm
@@ -1,129 +1,162 @@
 {
-    "cc": {
-        "configUri": "http://127.0.0.1:19002/admin/cluster/cc/config",
-        "statsUri": "http://127.0.0.1:19002/admin/cluster/cc/stats",
-        "threadDumpUri": "http://127.0.0.1:19002/admin/cluster/cc/threaddump"
+  "cc" : {
+    "configUri" : "http://127.0.0.1:19002/admin/cluster/cc/config",
+    "statsUri" : "http://127.0.0.1:19002/admin/cluster/cc/stats",
+    "threadDumpUri" : "http://127.0.0.1:19002/admin/cluster/cc/threaddump"
+  },
+  "config" : {
+    "api.port" : 19002,
+    "cluster.partitions" : {
+      "0" : {
+        "partitionId" : 0,
+        "nodeId" : "asterix_nc1",
+        "activeNodeId" : "asterix_nc1",
+        "active" : true,
+        "iodeviceNum" : 0
+      },
+      "1" : {
+        "partitionId" : 1,
+        "nodeId" : "asterix_nc1",
+        "activeNodeId" : "asterix_nc1",
+        "active" : true,
+        "iodeviceNum" : 1
+      },
+      "2" : {
+        "partitionId" : 2,
+        "nodeId" : "asterix_nc2",
+        "activeNodeId" : "asterix_nc2",
+        "active" : true,
+        "iodeviceNum" : 0
+      },
+      "3" : {
+        "partitionId" : 3,
+        "nodeId" : "asterix_nc2",
+        "activeNodeId" : "asterix_nc2",
+        "active" : true,
+        "iodeviceNum" : 1
+      }
     },
-    "config": {
-        "api.port": 19002,
-        "cluster.partitions": {
-            "0": "ID:0, Original Node: asterix_nc1, IODevice: 0, Active Node: asterix_nc1",
-            "1": "ID:1, Original Node: asterix_nc1, IODevice: 1, Active Node: asterix_nc1",
-            "2": "ID:2, Original Node: asterix_nc2, IODevice: 0, Active Node: asterix_nc2",
-            "3": "ID:3, Original Node: asterix_nc2, IODevice: 1, Active Node: asterix_nc2"
-        },
-        "compiler.framesize": 32768,
-        "compiler.groupmemory": 163840,
-        "compiler.joinmemory": 262144,
-        "compiler.parallelism": 3,
-        "compiler.pregelix.home": "~/pregelix",
-        "compiler.sortmemory": 327680,
-        "core.dump.paths": {},
-        "feed.central.manager.port": 4500,
-        "feed.max.threshold.period": 5,
-        "feed.memory.available.wait.timeout": 10,
-        "feed.memory.global.budget": 67108864,
-        "feed.pending.work.threshold": 50,
-        "feed.port": 19003,
-        "instance.name": null,
-        "log.level": "INFO",
-        "max.wait.active.cluster": 60,
-        "metadata.callback.port": 0,
-        "metadata.node": "asterix_nc1",
-        "metadata.partition": "ID:0, Original Node: asterix_nc1, IODevice: 0, Active Node: asterix_nc1",
-        "metadata.port": 0,
-        "metadata.registration.timeout.secs": 60,
-        "node.partitions": {
-            "asterix_nc1": [
-                "ID:0, Original Node: asterix_nc1, IODevice: 0, Active Node: asterix_nc1",
-                "ID:1, Original Node: asterix_nc1, IODevice: 1, Active Node: asterix_nc1"
-            ],
-            "asterix_nc2": [
-                "ID:2, Original Node: asterix_nc2, IODevice: 0, Active Node: asterix_nc2",
-                "ID:3, Original Node: asterix_nc2, IODevice: 1, Active Node: asterix_nc2"
-            ]
-        },
-        "node.stores": {
-            "asterix_nc1": [
-                "iodevice0",
-                "iodevice1"
-            ],
-            "asterix_nc2": [
-                "iodevice0",
-                "iodevice1"
-            ]
-        },
-        "plot.activate": false,
-        "storage.buffercache.maxopenfiles": 2147483647,
-        "storage.buffercache.pagesize": 32768,
-        "storage.buffercache.size": 50331648,
-        "storage.lsm.bloomfilter.falsepositiverate": 0.01,
-        "storage.memorycomponent.globalbudget": 536870912,
-        "storage.memorycomponent.numcomponents": 2,
-        "storage.memorycomponent.numpages": 8,
-        "storage.memorycomponent.pagesize": 131072,
-        "storage.metadata.memorycomponent.numpages": 256,
-        "transaction.log.dirs": {
-            "asterix_nc1": "target/txnLogDir/asterix_nc1",
-            "asterix_nc2": "target/txnLogDir/asterix_nc2"
-        },
-        "txn.commitprofiler.reportinterval": 5,
-        "txn.job.recovery.memorysize": 67108864,
-        "txn.lock.escalationthreshold": 1000,
-        "txn.lock.shrinktimer": 5000,
-        "txn.lock.timeout.sweepthreshold": 10000,
-        "txn.lock.timeout.waitthreshold": 60000,
-        "txn.log.buffer.numpages": 8,
-        "txn.log.buffer.pagesize": 131072,
-        "txn.log.checkpoint.history": 0,
-        "txn.log.checkpoint.lsnthreshold": 67108864,
-        "txn.log.checkpoint.pollfrequency": 120,
-        "txn.log.partitionsize": 268435456,
-        "web.port": 19001,
-        "web.queryinterface.port": 19006,
-        "web.secondary.port": 19005
+    "compiler.framesize" : 32768,
+    "compiler.groupmemory" : 163840,
+    "compiler.joinmemory" : 262144,
+    "compiler.parallelism" : 3,
+    "compiler.pregelix.home" : "~/pregelix",
+    "compiler.sortmemory" : 327680,
+    "core.dump.paths" : { },
+    "feed.central.manager.port" : 4500,
+    "feed.max.threshold.period" : 5,
+    "feed.memory.available.wait.timeout" : 10,
+    "feed.memory.global.budget" : 67108864,
+    "feed.pending.work.threshold" : 50,
+    "feed.port" : 19003,
+    "instance.name" : null,
+    "log.level" : "INFO",
+    "max.wait.active.cluster" : 60,
+    "metadata.callback.port" : 0,
+    "metadata.node" : "asterix_nc1",
+    "metadata.partition" : {
+      "partitionId" : 0,
+      "nodeId" : "asterix_nc1",
+      "activeNodeId" : "asterix_nc1",
+      "active" : true,
+      "iodeviceNum" : 0
     },
-    "diagnosticsUri": "http://127.0.0.1:19002/admin/diagnostics",
-    "fullShutdownUri": "http://127.0.0.1:19002/admin/shutdown?all=true",
-    "metadata_node": "asterix_nc1",
-    "ncs": [
-        {
-            "configUri": "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/config",
-            "node_id": "asterix_nc1",
-            "partitions": [
-                {
-                    "active": true,
-                    "partition_id": "partition_0"
-                },
-                {
-                    "active": true,
-                    "partition_id": "partition_1"
-                }
-            ],
-            "state": "ACTIVE",
-            "statsUri": "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/stats",
-            "threadDumpUri": "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/threaddump"
-        },
-        {
-            "configUri": "http://127.0.0.1:19002/admin/cluster/node/asterix_nc2/config",
-            "node_id": "asterix_nc2",
-            "partitions": [
-                {
-                    "active": true,
-                    "partition_id": "partition_2"
-                },
-                {
-                    "active": true,
-                    "partition_id": "partition_3"
-                }
-            ],
-            "state": "ACTIVE",
-            "statsUri": "http://127.0.0.1:19002/admin/cluster/node/asterix_nc2/stats",
-            "threadDumpUri": "http://127.0.0.1:19002/admin/cluster/node/asterix_nc2/threaddump"
-        }
-    ],
-    "replicationUri": "http://127.0.0.1:19002/admin/cluster/replication",
-    "shutdownUri": "http://127.0.0.1:19002/admin/shutdown",
-    "state": "ACTIVE",
-    "versionUri": "http://127.0.0.1:19002/admin/version"
+    "metadata.port" : 0,
+    "metadata.registration.timeout.secs" : 60,
+    "node.partitions" : {
+      "asterix_nc1" : [ {
+        "partitionId" : 0,
+        "nodeId" : "asterix_nc1",
+        "activeNodeId" : "asterix_nc1",
+        "active" : true,
+        "iodeviceNum" : 0
+      }, {
+        "partitionId" : 1,
+        "nodeId" : "asterix_nc1",
+        "activeNodeId" : "asterix_nc1",
+        "active" : true,
+        "iodeviceNum" : 1
+      } ],
+      "asterix_nc2" : [ {
+        "partitionId" : 2,
+        "nodeId" : "asterix_nc2",
+        "activeNodeId" : "asterix_nc2",
+        "active" : true,
+        "iodeviceNum" : 0
+      }, {
+        "partitionId" : 3,
+        "nodeId" : "asterix_nc2",
+        "activeNodeId" : "asterix_nc2",
+        "active" : true,
+        "iodeviceNum" : 1
+      } ]
+    },
+    "node.stores" : {
+      "asterix_nc1" : [ "iodevice0", "iodevice1" ],
+      "asterix_nc2" : [ "iodevice0", "iodevice1" ]
+    },
+    "plot.activate" : false,
+    "storage.buffercache.maxopenfiles" : 2147483647,
+    "storage.buffercache.pagesize" : 32768,
+    "storage.buffercache.size" : 50331648,
+    "storage.lsm.bloomfilter.falsepositiverate" : 0.01,
+    "storage.memorycomponent.globalbudget" : 536870912,
+    "storage.memorycomponent.numcomponents" : 2,
+    "storage.memorycomponent.numpages" : 8,
+    "storage.memorycomponent.pagesize" : 131072,
+    "storage.metadata.memorycomponent.numpages" : 256,
+    "transaction.log.dirs" : {
+      "asterix_nc1" : "target/txnLogDir/asterix_nc1",
+      "asterix_nc2" : "target/txnLogDir/asterix_nc2"
+    },
+    "txn.commitprofiler.reportinterval" : 5,
+    "txn.job.recovery.memorysize" : 67108864,
+    "txn.lock.escalationthreshold" : 1000,
+    "txn.lock.shrinktimer" : 5000,
+    "txn.lock.timeout.sweepthreshold" : 10000,
+    "txn.lock.timeout.waitthreshold" : 60000,
+    "txn.log.buffer.numpages" : 8,
+    "txn.log.buffer.pagesize" : 131072,
+    "txn.log.checkpoint.history" : 0,
+    "txn.log.checkpoint.lsnthreshold" : 67108864,
+    "txn.log.checkpoint.pollfrequency" : 120,
+    "txn.log.partitionsize" : 268435456,
+    "web.port" : 19001,
+    "web.queryinterface.port" : 19006,
+    "web.secondary.port" : 19005
+  },
+  "diagnosticsUri" : "http://127.0.0.1:19002/admin/diagnostics",
+  "fullShutdownUri" : "http://127.0.0.1:19002/admin/shutdown?all=true",
+  "metadata_node" : "asterix_nc1",
+  "ncs" : [ {
+    "configUri" : "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/config",
+    "node_id" : "asterix_nc1",
+    "partitions" : [ {
+      "active" : true,
+      "partition_id" : "partition_0"
+    }, {
+      "active" : true,
+      "partition_id" : "partition_1"
+    } ],
+    "state" : "ACTIVE",
+    "statsUri" : "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/stats",
+    "threadDumpUri" : "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/threaddump"
+  }, {
+    "configUri" : "http://127.0.0.1:19002/admin/cluster/node/asterix_nc2/config",
+    "node_id" : "asterix_nc2",
+    "partitions" : [ {
+      "active" : true,
+      "partition_id" : "partition_2"
+    }, {
+      "active" : true,
+      "partition_id" : "partition_3"
+    } ],
+    "state" : "ACTIVE",
+    "statsUri" : "http://127.0.0.1:19002/admin/cluster/node/asterix_nc2/stats",
+    "threadDumpUri" : "http://127.0.0.1:19002/admin/cluster/node/asterix_nc2/threaddump"
+  } ],
+  "replicationUri" : "http://127.0.0.1:19002/admin/cluster/replication",
+  "shutdownUri" : "http://127.0.0.1:19002/admin/shutdown",
+  "state" : "ACTIVE",
+  "versionUri" : "http://127.0.0.1:19002/admin/version"
 }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_3/cluster_state_3.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_3/cluster_state_3.1.adm
index b0815ee..14a00d0 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_3/cluster_state_3.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_3/cluster_state_3.1.adm
@@ -1,36 +1,29 @@
-{"ncs": [
-    {
-        "configUri": "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/config",
-        "node_id": "asterix_nc1",
-        "partitions": [
-            {
-                "active": true,
-                "partition_id": "partition_0"
-            },
-            {
-                "active": true,
-                "partition_id": "partition_1"
-            }
-        ],
-        "state": "ACTIVE",
-        "statsUri": "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/stats",
-        "threadDumpUri": "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/threaddump"
-    },
-    {
-        "configUri": "http://127.0.0.1:19002/admin/cluster/node/asterix_nc2/config",
-        "node_id": "asterix_nc2",
-        "partitions": [
-            {
-                "active": true,
-                "partition_id": "partition_2"
-            },
-            {
-                "active": true,
-                "partition_id": "partition_3"
-            }
-        ],
-        "state": "ACTIVE",
-        "statsUri": "http://127.0.0.1:19002/admin/cluster/node/asterix_nc2/stats",
-        "threadDumpUri": "http://127.0.0.1:19002/admin/cluster/node/asterix_nc2/threaddump"
-    }
-]}
+{
+  "ncs" : [ {
+    "node_id" : "asterix_nc1",
+    "state" : "ACTIVE",
+    "partitions" : [ {
+      "partition_id" : "partition_0",
+      "active" : true
+    }, {
+      "partition_id" : "partition_1",
+      "active" : true
+    } ],
+    "configUri" : "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/config",
+    "statsUri" : "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/stats",
+    "threadDumpUri" : "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/threaddump"
+  }, {
+    "node_id" : "asterix_nc2",
+    "state" : "ACTIVE",
+    "partitions" : [ {
+      "partition_id" : "partition_2",
+      "active" : true
+    }, {
+      "partition_id" : "partition_3",
+      "active" : true
+    } ],
+    "configUri" : "http://127.0.0.1:19002/admin/cluster/node/asterix_nc2/config",
+    "statsUri" : "http://127.0.0.1:19002/admin/cluster/node/asterix_nc2/stats",
+    "threadDumpUri" : "http://127.0.0.1:19002/admin/cluster/node/asterix_nc2/threaddump"
+  } ]
+}
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_4/cluster_state_4.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_4/cluster_state_4.1.adm
index 4635690..5e88f5c 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_4/cluster_state_4.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_4/cluster_state_4.1.adm
@@ -1,17 +1,14 @@
 {
-    "configUri": "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/config",
-    "node_id": "asterix_nc1",
-    "partitions": [
-        {
-            "active": true,
-            "partition_id": "partition_0"
-        },
-        {
-            "active": true,
-            "partition_id": "partition_1"
-        }
-    ],
-    "state": "ACTIVE",
-    "statsUri": "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/stats",
-    "threadDumpUri": "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/threaddump"
-}
+  "node_id" : "asterix_nc1",
+  "state" : "ACTIVE",
+  "partitions" : [ {
+    "partition_id" : "partition_0",
+    "active" : true
+  }, {
+    "partition_id" : "partition_1",
+    "active" : true
+  } ],
+  "configUri" : "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/config",
+  "statsUri" : "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/stats",
+  "threadDumpUri" : "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/threaddump"
+}
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_cc_1/cluster_state_cc_1.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_cc_1/cluster_state_cc_1.1.adm
index 5e1e154..879ecbc 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_cc_1/cluster_state_cc_1.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_cc_1/cluster_state_cc_1.1.adm
@@ -1,5 +1,5 @@
 {
-    "configUri": "http://127.0.0.1:19002/admin/cluster/cc/config",
-    "statsUri": "http://127.0.0.1:19002/admin/cluster/cc/stats",
-    "threadDumpUri": "http://127.0.0.1:19002/admin/cluster/cc/threaddump"
-}
+  "configUri" : "http://127.0.0.1:19002/admin/cluster/cc/config",
+  "statsUri" : "http://127.0.0.1:19002/admin/cluster/cc/stats",
+  "threadDumpUri" : "http://127.0.0.1:19002/admin/cluster/cc/threaddump"
+}
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_cc_stats_1/cluster_state_cc_stats_1.1.regexadm b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_cc_stats_1/cluster_state_cc_stats_1.1.regexadm
index 196a12b..01ff72a 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_cc_stats_1/cluster_state_cc_stats_1.1.regexadm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_cc_stats_1/cluster_state_cc_stats_1.1.regexadm
@@ -1,27 +1,24 @@
 \{
-    "date": ".*",
-    "gcs": \[
-        \{
-            "collection-count": .*,
-            "collection-time": .*,
-            "name": ".*"
-        \},
-        \{
-            "collection-count": .*,
-            "collection-time": .*,
-            "name": ".*"
-        \}
-    \],
-    "heap_committed_size": [0-9]*,
-    "heap_init_size": [0-9]*,
-    "heap_max_size": [0-9]*,
-    "heap_used_size": [0-9]*,
-    "nonheap_committed_size": [0-9]*,
-    "nonheap_init_size": [0-9]*,
-    "nonheap_max_size": -?[0-9]*,
-    "nonheap_used_size": [0-9]*,
-    "peak_thread_count": [0-9]*,
-    "started_thread_count": [0-9]*,
-    "system_load_average": [0-9\.]*,
-    "thread_count": [0-9]*
-\}
\ No newline at end of file
+  "gcs" : \[ \{
+    "name" : ".*",
+    "collection-time" : .*,
+    "collection-count" : .*
+  \}, \{
+    "name" : ".*",
+    "collection-time" : .*,
+    "collection-count" : .*
+  \} \],
+  "date" : ".*",
+  "heap_init_size" : [0-9]*,
+  "heap_used_size" : [0-9]*,
+  "heap_committed_size" : [0-9]*,
+  "heap_max_size" : [0-9]*,
+  "nonheap_init_size" : [0-9]*,
+  "nonheap_used_size" : [0-9]*,
+  "nonheap_committed_size" : [0-9]*,
+  "nonheap_max_size" : -?[0-9]*,
+  "thread_count" : [0-9]*,
+  "peak_thread_count" : [0-9]*,
+  "started_thread_count" : [0-9]*,
+  "system_load_average" : [0-9\.]*
+\}*
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_nc_threaddump_1/cluster_state_cc_threaddump_1.1.regex b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_nc_threaddump_1/cluster_state_cc_threaddump_1.1.regex
index 1e5c47b..3f1bfdc 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_nc_threaddump_1/cluster_state_cc_threaddump_1.1.regex
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_nc_threaddump_1/cluster_state_cc_threaddump_1.1.regex
@@ -1,10 +1,10 @@
-/"date": ".*"/
-/"threads": \[/
-/"id": [0-9]+/
-/"lock_name": ".*"/
-/"name": ".*"/
-/"stack": \[/
+/"date" : ".*"/
+/"threads" : \[/
+/"id" : [0-9]+/
+/"lock_name" : ".*"/
+/"name" : ".*"/
+/"stack" : \[/
 /"java.lang.Thread.run\(Thread.java:[0-9]+\)"/
-/"state": "TIMED_WAITING"/
-/"state": "RUNNABLE"/
-/"state": "WAITING"/
\ No newline at end of file
+/"state" : "TIMED_WAITING"/
+/"state" : "RUNNABLE"/
+/"state" : "WAITING"/
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/diagnostics_1/diagnostics_1.1.regexadm b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/diagnostics_1/diagnostics_1.1.regexadm
index 29c03bf..b2dafd9 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/diagnostics_1/diagnostics_1.1.regexadm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/diagnostics_1/diagnostics_1.1.regexadm
@@ -1,10 +1,7 @@
-.*"cc": \{
-        "config": \{.*
-        \},
-        "stats": \{.*
-        \},
-        "threaddump": \{.*
-        \}
-.*"ncs".*"node_id": "asterix_nc1",
-.*"threaddump".*"node_id": "asterix_nc2",
-.*"threaddump".*
\ No newline at end of file
+.*"cc" : \{.*
+    "stats" : \{.*
+    \},.*
+    "threaddump" : \{.*
+    \},.*
+    "config" : \{.*
+    \}.*"ncs".*"node_id" : "asterix_nc1".*"threaddump".*"node_id" : "asterix_nc2".*"threaddump".*
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/replication/replication.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/replication/replication.1.adm
index 8adc10c..74e019b 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/replication/replication.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/replication/replication.1.adm
@@ -1,9 +1,11 @@
-{"config": {
-    "enabled": false,
-    "factor": 2,
-    "log.batchsize": 4096,
-    "log.buffer.numpages": 8,
-    "log.buffer.pagesize": 131072,
-    "max.remote.recovery.attempts": 5,
-    "timeout": 30
-}}
+{
+  "config" : {
+    "enabled" : false,
+    "factor" : 2,
+    "log.batchsize" : 4096,
+    "log.buffer.numpages" : 8,
+    "log.buffer.pagesize" : 131072,
+    "max.remote.recovery.attempts" : 5,
+    "timeout" : 30
+  }
+}
\ No newline at end of file
diff --git a/asterixdb/asterix-client-helper/pom.xml b/asterixdb/asterix-client-helper/pom.xml
index 3270fbb..04de18a 100644
--- a/asterixdb/asterix-client-helper/pom.xml
+++ b/asterixdb/asterix-client-helper/pom.xml
@@ -108,8 +108,12 @@
       <artifactId>commons-io</artifactId>
     </dependency>
     <dependency>
-      <groupId>org.json</groupId>
-      <artifactId>json</artifactId>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-databind</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-core</artifactId>
     </dependency>
   </dependencies>
 </project>
diff --git a/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/GetClusterStateCommand.java b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/GetClusterStateCommand.java
index 77ed78f..e0fcb06 100644
--- a/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/GetClusterStateCommand.java
+++ b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/GetClusterStateCommand.java
@@ -24,10 +24,11 @@
 
 import javax.servlet.http.HttpServletResponse;
 
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
 import org.apache.asterix.clienthelper.Args;
 import org.apache.commons.io.IOUtils;
-import org.json.JSONException;
-import org.json.JSONObject;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 
 public class GetClusterStateCommand extends RemoteCommand {
 
@@ -49,8 +50,9 @@
             conn = openConnection(args.getClusterStatePath(), Method.GET);
             if (conn.getResponseCode() == HttpServletResponse.SC_OK) {
                 String result = IOUtils.toString(conn.getInputStream(), StandardCharsets.UTF_8.name());
-                JSONObject json = new JSONObject(result);
-                final String state = json.getString("state");
+                ObjectMapper om = new ObjectMapper();
+                JsonNode json = om.readTree(result);
+                final String state = json.get("state").asText();
                 logState(state);
                 switch (state) {
                     case "ACTIVE":
@@ -66,9 +68,6 @@
         } catch (IOException e) { // NOSONAR - log or rethrow exception
             logState("DOWN");
             return 1;
-        } catch (JSONException e) { // NOSONAR - log or rethrow exception
-            logState("UNKNOWN (malformed response)");
-            return 3;
         }
     }
 }
diff --git a/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/WaitForClusterCommand.java b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/WaitForClusterCommand.java
index b0b4c6f..dad9f8c 100644
--- a/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/WaitForClusterCommand.java
+++ b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/WaitForClusterCommand.java
@@ -25,10 +25,11 @@
 
 import javax.servlet.http.HttpServletResponse;
 
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
 import org.apache.asterix.clienthelper.Args;
 import org.apache.commons.io.IOUtils;
-import org.json.JSONException;
-import org.json.JSONObject;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 
 public class WaitForClusterCommand extends RemoteCommand {
 
@@ -66,14 +67,15 @@
                 conn = openConnection(args.getClusterStatePath(), Method.GET);
                 if (conn.getResponseCode() == HttpServletResponse.SC_OK) {
                     String result = IOUtils.toString(conn.getInputStream(), StandardCharsets.UTF_8.name());
-                    JSONObject json = new JSONObject(result);
-                    lastState = json.getString("state");
+                    ObjectMapper om = new ObjectMapper();
+                    JsonNode json = om.readTree(result);
+                    lastState = json.get("state").asText();
                     if ("ACTIVE".equals(lastState)) {
                         log("Cluster started and is ACTIVE.");
                         return 0;
                     }
                 }
-            } catch (JSONException |IOException e) { //NOSONAR - log or rethrow exception
+            } catch (IOException e) { //NOSONAR - log or rethrow exception
                 // ignore exception, try again
             }
         }
diff --git a/asterixdb/asterix-common/pom.xml b/asterixdb/asterix-common/pom.xml
index d4a4517..722e1c5 100644
--- a/asterixdb/asterix-common/pom.xml
+++ b/asterixdb/asterix-common/pom.xml
@@ -270,10 +270,6 @@
       <version>1.2.17</version>
     </dependency>
     <dependency>
-      <groupId>org.json</groupId>
-      <artifactId>json</artifactId>
-    </dependency>
-    <dependency>
       <groupId>javax.servlet</groupId>
       <artifactId>javax.servlet-api</artifactId>
       <scope>test</scope>
@@ -307,6 +303,19 @@
       <version>2.0.2-beta</version>
       <scope>test</scope>
     </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>
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-core</artifactId>
+    </dependency>
   </dependencies>
 
 </project>
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AbstractProperties.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AbstractProperties.java
index b6a960f..eccbff2 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AbstractProperties.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AbstractProperties.java
@@ -49,9 +49,14 @@
         Map<String, Object> properties = new HashMap<>();
         for (Method m : getClass().getMethods()) {
             PropertyKey key = m.getAnnotation(PropertyKey.class);
+            Stringify stringify = m.getAnnotation(Stringify.class);
             if (key != null) {
                 try {
-                    properties.put(keyTransformer.apply(key.value()), m.invoke(this));
+                    if (stringify != null) {
+                        properties.put(keyTransformer.apply(key.value()), String.valueOf(m.invoke(this)));
+                    } else {
+                        properties.put(keyTransformer.apply(key.value()), m.invoke(this));
+                    }
                 } catch (Exception e) {
                     LOGGER.log(Level.INFO, "Error accessing property: " + key.value(), e);
                 }
@@ -65,6 +70,10 @@
         String value();
     }
 
+    @Retention(RetentionPolicy.RUNTIME)
+    public @interface Stringify {
+    }
+
     public static List<AbstractProperties> getImplementations() {
         return Collections.unmodifiableList(IMPLS);
     }
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/ExternalProperties.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/ExternalProperties.java
index dac154c..eb6bda5 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/ExternalProperties.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/ExternalProperties.java
@@ -22,35 +22,35 @@
 
 public class ExternalProperties extends AbstractProperties {
 
-    private static final String EXTERNAL_WEBPORT_KEY = "web.port";
-    private static final int EXTERNAL_WEBPORT_DEFAULT = 19001;
+    public static final String EXTERNAL_WEBPORT_KEY = "web.port";
+    public static final int EXTERNAL_WEBPORT_DEFAULT = 19001;
 
-    private static final String EXTERNAL_SECONDARY_WEBPORT_KEY = "web.secondary.port";
-    private static final int EXTERNAL_SECONDARY_WEBPORT_DEFAULT = 19005;
+    public static final String EXTERNAL_SECONDARY_WEBPORT_KEY = "web.secondary.port";
+    public static final int EXTERNAL_SECONDARY_WEBPORT_DEFAULT = 19005;
 
-    private static final String QUERY_WEBPORT_KEY = "web.queryinterface.port";
-    private static final int QUERY_WEBPORT_DEFAULT = 19006;
+    public static final String QUERY_WEBPORT_KEY = "web.queryinterface.port";
+    public static final int QUERY_WEBPORT_DEFAULT = 19006;
 
-    private static final String EXTERNAL_LOGLEVEL_KEY = "log.level";
-    private static final Level EXTERNAL_LOGLEVEL_DEFAULT = Level.WARNING;
+    public static final String EXTERNAL_LOGLEVEL_KEY = "log.level";
+    public static final Level EXTERNAL_LOGLEVEL_DEFAULT = Level.WARNING;
 
-    private static final String EXTERNAL_APISERVER_KEY = "api.port";
-    private static final int EXTERNAL_APISERVER_DEFAULT = 19002;
+    public static final String EXTERNAL_APISERVER_KEY = "api.port";
+    public static final int EXTERNAL_APISERVER_DEFAULT = 19002;
 
-    private static final String EXTERNAL_FEEDSERVER_KEY = "feed.port";
-    private static final int EXTERNAL_FEEDSERVER_DEFAULT = 19003;
+    public static final String EXTERNAL_FEEDSERVER_KEY = "feed.port";
+    public static final int EXTERNAL_FEEDSERVER_DEFAULT = 19003;
 
-    private static final String EXTERNAL_CC_JAVA_OPTS_KEY = "cc.java.opts";
-    private static final String EXTERNAL_CC_JAVA_OPTS_DEFAULT = "-Xmx1024m";
+    public static final String EXTERNAL_CC_JAVA_OPTS_KEY = "cc.java.opts";
+    public static final String EXTERNAL_CC_JAVA_OPTS_DEFAULT = "-Xmx1024m";
 
-    private static final String EXTERNAL_NC_JAVA_OPTS_KEY = "nc.java.opts";
-    private static final String EXTERNAL_NC_JAVA_OPTS_DEFAULT = "-Xmx1024m";
+    public static final String EXTERNAL_NC_JAVA_OPTS_KEY = "nc.java.opts";
+    public static final String EXTERNAL_NC_JAVA_OPTS_DEFAULT = "-Xmx1024m";
 
-    private static final String EXTERNAL_MAX_WAIT_FOR_ACTIVE_CLUSTER = "max.wait.active.cluster";
-    private static final int EXTERNAL_MAX_WAIT_FOR_ACTIVE_CLUSTER_DEFAULT = 60;
+    public static final String EXTERNAL_MAX_WAIT_FOR_ACTIVE_CLUSTER = "max.wait.active.cluster";
+    public static final int EXTERNAL_MAX_WAIT_FOR_ACTIVE_CLUSTER_DEFAULT = 60;
 
-    private static final String EXTERNAL_PLOT_ACTIVATE = "plot.activate";
-    private static final boolean EXTERNAL_PLOT_ACTIVATE_DEFAULT = false;
+    public static final String EXTERNAL_PLOT_ACTIVATE = "plot.activate";
+    public static final boolean EXTERNAL_PLOT_ACTIVATE_DEFAULT = false;
 
     public ExternalProperties(PropertiesAccessor accessor) {
         super(accessor);
@@ -87,6 +87,7 @@
     }
 
     @PropertyKey(EXTERNAL_LOGLEVEL_KEY)
+    @Stringify
     public Level getLogLevel() {
         return accessor.getProperty(EXTERNAL_LOGLEVEL_KEY, EXTERNAL_LOGLEVEL_DEFAULT,
                 PropertyInterpreters.getLevelPropertyInterpreter());
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/JSONUtil.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/JSONUtil.java
index 0cbf1b9..80df260 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/JSONUtil.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/JSONUtil.java
@@ -18,49 +18,65 @@
  */
 package org.apache.asterix.common.utils;
 
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+
+import java.io.IOException;
 import java.util.Iterator;
 import java.util.logging.Logger;
 
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-
 public class JSONUtil {
 
     private static final Logger LOGGER = Logger.getLogger(JSONUtil.class.getName());
 
     private static final String INDENT = "\t";
 
+    private static final ObjectMapper SORTED_MAPPER = new ObjectMapper();
+
     private JSONUtil() {
     }
 
+    static {
+        SORTED_MAPPER.configure(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, true);
+    }
+
+    public static String convertNode(final JsonNode node) throws JsonProcessingException {
+        final Object obj = SORTED_MAPPER.treeToValue(node, Object.class);
+        final String json = SORTED_MAPPER.writerWithDefaultPrettyPrinter().writeValueAsString(obj);
+        return json;
+    }
+
     public static String indent(String str, int initialIndent) {
+        ObjectMapper om = new ObjectMapper();
         try {
-            return append(new StringBuilder(), new JSONObject(str), initialIndent).toString();
-        } catch (JSONException e) {
+            return appendObj(new StringBuilder(), om.readTree(str), initialIndent).toString();
+        } catch (IOException e) {
+            LOGGER.finest(String.valueOf(e));
             LOGGER.finest("Could not indent JSON string, returning the input string: " + str);
             return str;
         }
     }
 
-    private static StringBuilder append(StringBuilder sb, Object o, int indent) throws JSONException {
-        if (o instanceof JSONObject) {
-            return append(sb, (JSONObject) o, indent);
-        } else if (o instanceof JSONArray) {
-            return append(sb, (JSONArray) o, indent);
-        } else if (o instanceof String) {
-            return quoteAndEscape(sb, (String) o);
-        } else if (JSONObject.NULL.equals(o) || o instanceof Number || o instanceof Boolean) {
+    private static StringBuilder appendOrd(StringBuilder sb, JsonNode o, int indent) {
+        if (o.isObject()) {
+            return appendObj(sb, o, indent);
+        } else if (o.isArray()) {
+            return appendAry(sb, o, indent);
+        } else if (o.isTextual()) {
+            return quoteAndEscape(sb, o.asText());
+        } else if (o.isNull() || o.isIntegralNumber() || o.isBoolean()) {
             return sb.append(String.valueOf(o));
         }
         throw new UnsupportedOperationException(o.getClass().getSimpleName());
     }
 
-    private static StringBuilder append(StringBuilder builder, JSONObject jobj, int indent) throws JSONException {
+    private static StringBuilder appendObj(StringBuilder builder, JsonNode jobj, int indent) {
         StringBuilder sb = builder.append("{\n");
         boolean first = true;
-        for (Iterator it = jobj.keys(); it.hasNext();) {
-            final String key = (String) it.next();
+        for (Iterator<JsonNode> it = jobj.iterator(); it.hasNext();) {
+            final String key = it.next().asText();
             if (first) {
                 first = false;
             } else {
@@ -69,20 +85,32 @@
             sb = indent(sb, indent + 1);
             sb = quote(sb, key);
             sb = sb.append(": ");
-            sb = append(sb, jobj.get(key), indent + 1);
+            if (jobj.get(key).isArray()) {
+                sb = appendAry(sb, jobj.get(key), indent + 1);
+            } else if (jobj.get(key).isObject()) {
+                sb = appendObj(sb, jobj.get(key), indent + 1);
+            } else {
+                sb = appendOrd(sb, jobj.get(key), indent + 1);
+            }
         }
         sb = sb.append("\n");
         return indent(sb, indent).append("}");
     }
 
-    private static StringBuilder append(StringBuilder builder, JSONArray jarr, int indent) throws JSONException {
+    private static StringBuilder appendAry(StringBuilder builder, JsonNode jarr, int indent) {
         StringBuilder sb = builder.append("[\n");
-        for (int i = 0; i < jarr.length(); ++i) {
+        for (int i = 0; i < jarr.size(); ++i) {
             if (i > 0) {
                 sb = sb.append(",\n");
             }
             sb = indent(sb, indent + 1);
-            sb = append(sb, jarr.get(i), indent + 1);
+            if (jarr.get(i).isArray()) {
+                sb = appendAry(sb, jarr.get(i), indent + 1);
+            } else if (jarr.get(i).isObject()) {
+                sb = appendObj(sb, jarr.get(i), indent + 1);
+            } else {
+                sb = appendOrd(sb, jarr.get(i), indent + 1);
+            }
         }
         sb = sb.append("\n");
         return indent(sb, indent).append("]");
diff --git a/asterixdb/asterix-common/src/test/java/org/apache/asterix/test/aql/ResultExtractor.java b/asterixdb/asterix-common/src/test/java/org/apache/asterix/test/aql/ResultExtractor.java
index 662888e..8399f7a 100644
--- a/asterixdb/asterix-common/src/test/java/org/apache/asterix/test/aql/ResultExtractor.java
+++ b/asterixdb/asterix-common/src/test/java/org/apache/asterix/test/aql/ResultExtractor.java
@@ -19,18 +19,24 @@
 package org.apache.asterix.test.aql;
 
 import java.io.InputStream;
+import java.io.StringWriter;
 import java.nio.charset.Charset;
+import java.util.Iterator;
 import java.util.logging.Logger;
 
+import com.fasterxml.jackson.core.JsonFactory;
+import com.fasterxml.jackson.core.PrettyPrinter;
+import com.fasterxml.jackson.core.util.DefaultPrettyPrinter;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.google.common.collect.Iterators;
+import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.commons.io.IOUtils;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-import org.json.JSONTokener;
 
 /**
  * extracts results from the response of the QueryServiceServlet.
- *
  * As the response is not necessarily valid JSON, non-JSON content has to be extracted in some cases.
  * The current implementation creates a toomany copies of the data to be usable for larger results.
  */
@@ -39,150 +45,84 @@
     private static final Logger LOGGER = Logger.getLogger(ResultExtractor.class.getName());
 
     public static InputStream extract(InputStream resultStream) throws Exception {
-        final Charset utf8 = Charset.forName("UTF-8");
-        String result = IOUtils.toString(resultStream, utf8);
+        ObjectMapper om = new ObjectMapper();
+        StringWriter sw = new StringWriter();
+        String resultStr = IOUtils.toString(resultStream, Charset.defaultCharset());
+        PrettyPrinter singleLine = new SingleLinePrettyPrinter();
+        ObjectNode result = om.readValue(resultStr, ObjectNode.class);
 
         LOGGER.fine("+++++++\n" + result + "\n+++++++\n");
 
-        JSONTokener tokener = new JSONTokener(result);
-        tokener.nextTo('{');
-        tokener.next('{');
-        String name;
-        String type = null;
-        String status = null;
+        String type = "";
+        String status = "";
         String results = "";
-        while ((name = getFieldName(tokener)) != null) {
-            if ("requestID".equals(name) || "signature".equals(name)) {
-                getStringField(tokener);
-            } else if ("status".equals(name)) {
-                status = getStringField(tokener);
-            } else if ("type".equals(name)) {
-                type = getStringField(tokener);
-            } else if ("metrics".equals(name)) {
-                JSONObject metrics = getObjectField(tokener);
-                LOGGER.fine(name + ": " + metrics);
-            } else if ("errors".equals(name)) {
-                JSONArray errors = getArrayField(tokener);
-                LOGGER.fine(name + ": " + errors);
-                JSONObject err = errors.getJSONObject(0);
-                throw new Exception(err.getString("msg"));
-            } else if ("results".equals(name)) {
-                results = getResults(tokener, type);
-            } else {
-                throw tokener.syntaxError(name + ": unanticipated field");
+        String field = "";
+        for (Iterator<String> sIter = result.fieldNames(); sIter.hasNext();) {
+            field = sIter.next();
+            switch (field) {
+                case "requestID":
+                    break;
+                case "signature":
+                    break;
+                case "status":
+                    status = om.writeValueAsString(result.get(field));
+                    break;
+                case "type":
+                    type = om.writeValueAsString(result.get(field));
+                    break;
+                case "metrics":
+                    LOGGER.fine(om.writeValueAsString(result.get(field)));
+                    break;
+                case "errors":
+                    JsonNode errors = result.get(field).get(0).get("msg");
+                    throw new AsterixException(errors.asText());
+                case "results":
+                    if (result.get(field).size() <= 1) {
+                        if (result.get(field).size() == 0) {
+                            results = "";
+                        } else if (result.get(field).isArray()) {
+                            if (result.get(field).get(0).isTextual()) {
+                                results = result.get(field).get(0).asText();
+                            } else {
+                                ObjectMapper omm = new ObjectMapper();
+                                omm.setDefaultPrettyPrinter(singleLine);
+                                omm.enable(SerializationFeature.INDENT_OUTPUT);
+                                results = omm.writer(singleLine).writeValueAsString(result.get(field));
+                            }
+                        } else {
+                            results = om.writeValueAsString(result.get(field));
+                        }
+                    } else {
+                        StringBuilder sb = new StringBuilder();
+                        JsonNode[] fields = Iterators.toArray(result.get(field).elements(), JsonNode.class);
+                        if (fields.length > 1) {
+                            for (JsonNode f : fields) {
+                                if (f.isObject()) {
+                                    sb.append(om.writeValueAsString(f));
+                                } else {
+                                    sb.append(f.asText());
+                                }
+                            }
+                        }
+                        results = sb.toString();
+                    }
+                    break;
+                default:
+                    throw new AsterixException(field + "unanticipated field");
             }
         }
-        while (tokener.more() && tokener.skipTo('}') != '}') {
-            // skip along
-        }
-        tokener.next('}');
-        if (! "success".equals(status)) {
-            throw new Exception("Unexpected status: '" + status + "'");
-        }
-        return IOUtils.toInputStream(results, utf8);
+
+        return IOUtils.toInputStream(results);
     }
 
     public static String extractHandle(InputStream resultStream) throws Exception {
         final Charset utf8 = Charset.forName("UTF-8");
+        ObjectMapper om = new ObjectMapper();
         String result = IOUtils.toString(resultStream, utf8);
-        JSONObject parsed = new JSONObject(result);
-        JSONArray handle = parsed.getJSONArray("handle");
-        JSONObject res = new JSONObject();
-        res.put("handle", handle);
-        return res.toString();
-    }
-
-    private static String getFieldName(JSONTokener tokener) throws JSONException {
-        char c = tokener.skipTo('"');
-        if (c != '"') {
-            return null;
-        }
-        tokener.next('"');
-        return tokener.nextString('"');
-    }
-
-    private static String getStringField(JSONTokener tokener) throws JSONException {
-        tokener.skipTo('"');
-        tokener.next('"');
-        return tokener.nextString('"');
-    }
-
-    private static JSONArray getArrayField(JSONTokener tokener) throws JSONException {
-        tokener.skipTo(':');
-        tokener.next(':');
-        Object obj = tokener.nextValue();
-        if (obj instanceof JSONArray) {
-            return (JSONArray) obj;
-        } else {
-            throw tokener.syntaxError(String.valueOf(obj) + ": unexpected value");
-        }
-    }
-
-    private static JSONObject getObjectField(JSONTokener tokener) throws JSONException {
-        tokener.skipTo(':');
-        tokener.next(':');
-        Object obj = tokener.nextValue();
-        if (obj instanceof JSONObject) {
-            return (JSONObject) obj;
-        } else {
-            throw tokener.syntaxError(String.valueOf(obj) + ": unexpected value");
-        }
-    }
-
-    private static String getResults(JSONTokener tokener, String type) throws JSONException {
-        tokener.skipTo(':');
-        tokener.next(':');
-        StringBuilder result = new StringBuilder();
-        if (type != null) {
-            // a type was provided in the response and so the result is encoded as an array of escaped strings that
-            // need to be concatenated
-            Object obj = tokener.nextValue();
-            if (!(obj instanceof JSONArray)) {
-                throw tokener.syntaxError("array expected");
-            }
-            JSONArray array = (JSONArray) obj;
-            for (int i = 0; i < array.length(); ++i) {
-                result.append(array.getString(i));
-            }
-            return result.toString();
-        } else {
-            int level = 0;
-            boolean inQuote = false;
-            while (tokener.more()) {
-                char c = tokener.next();
-                switch (c) {
-                    case '{':
-                    case '[':
-                        ++level;
-                        result.append(c);
-                        break;
-                    case '}':
-                    case ']':
-                        --level;
-                        result.append(c);
-                        break;
-                    case '"':
-                        if (inQuote) {
-                            --level;
-                        } else {
-                            ++level;
-                        }
-                        inQuote = !inQuote;
-                        result.append(c);
-                        break;
-                    case ',':
-                        if (level == 0) {
-                            return result.toString().trim();
-                        } else {
-                            result.append(c);
-                        }
-                        break;
-                    default:
-                        result.append(c);
-                        break;
-                }
-            }
-        }
-        return null;
+        ObjectNode resultJson = om.readValue(result, ObjectNode.class);
+        JsonNode handle = resultJson.get("handle");
+        ObjectNode res = om.createObjectNode();
+        res.set("handle", handle);
+        return om.writeValueAsString(res);
     }
 }
diff --git a/asterixdb/asterix-common/src/test/java/org/apache/asterix/test/aql/SingleLinePrettyPrinter.java b/asterixdb/asterix-common/src/test/java/org/apache/asterix/test/aql/SingleLinePrettyPrinter.java
new file mode 100644
index 0000000..52f68a0
--- /dev/null
+++ b/asterixdb/asterix-common/src/test/java/org/apache/asterix/test/aql/SingleLinePrettyPrinter.java
@@ -0,0 +1,404 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.asterix.test.aql;
+
+import java.io.*;
+
+import com.fasterxml.jackson.core.*;
+import com.fasterxml.jackson.core.io.SerializedString;
+import com.fasterxml.jackson.core.util.DefaultIndenter;
+import com.fasterxml.jackson.core.util.Instantiatable;
+
+/**
+ * Default {@link PrettyPrinter} implementation that uses 2-space
+ * indentation with platform-default linefeeds.
+ * Usually this class is not instantiated directly, but instead
+ * method {@link JsonGenerator#useSingleLinePrettyPrinter} is
+ * used, which will use an instance of this class for operation.
+ */
+@SuppressWarnings("serial")
+public class SingleLinePrettyPrinter
+        implements PrettyPrinter, Instantiatable<SingleLinePrettyPrinter>, java.io.Serializable {
+    private static final long serialVersionUID = 1;
+
+    /**
+     * Constant that specifies default "root-level" separator to use between
+     * root values: a single space character.
+     *
+     * @since 2.1
+     */
+    public final static SerializedString DEFAULT_ROOT_VALUE_SEPARATOR = new SerializedString(" ");
+
+    /**
+     * Interface that defines objects that can produce indentation used
+     * to separate object entries and array values. Indentation in this
+     * context just means insertion of white space, independent of whether
+     * linefeeds are output.
+     */
+    public interface Indenter {
+        void writeIndentation(JsonGenerator jg, int level) throws IOException;
+
+        /**
+         * @return True if indenter is considered inline (does not add linefeeds),
+         *         false otherwise
+         */
+        boolean isInline();
+    }
+
+    // // // Config, indentation
+
+    /**
+     * By default, let's use only spaces to separate array values.
+     */
+    protected Indenter _arrayIndenter = FixedSpaceIndenter.instance;
+
+    /**
+     * By default, let's use linefeed-adding indenter for separate
+     * object entries. We'll further configure indenter to use
+     * system-specific linefeeds, and 2 spaces per level (as opposed to,
+     * say, single tabs)
+     */
+    protected Indenter _objectIndenter = new FixedSpaceIndenter();
+
+    /**
+     * String printed between root-level values, if any.
+     */
+    protected final SerializableString _rootSeparator;
+
+    // // // Config, other white space configuration
+
+    /**
+     * By default we will add spaces around colons used to
+     * separate object fields and values.
+     * If disabled, will not use spaces around colon.
+     */
+    protected boolean _spacesInObjectEntries = true;
+
+    // // // State:
+
+    /**
+     * Number of open levels of nesting. Used to determine amount of
+     * indentation to use.
+     */
+    protected transient int _nesting;
+
+    /*
+    /**********************************************************
+    /* Life-cycle (construct, configure)
+    /**********************************************************
+    */
+
+    public SingleLinePrettyPrinter() {
+        this(DEFAULT_ROOT_VALUE_SEPARATOR);
+    }
+
+    /**
+     * Constructor that specifies separator String to use between root values;
+     * if null, no separator is printed.
+     * <p>
+     * Note: simply constructs a {@link SerializedString} out of parameter,
+     * calls {@link #SingleLinePrettyPrinter(SerializableString)}
+     *
+     * @param rootSeparator
+     * @since 2.1
+     */
+    public SingleLinePrettyPrinter(String rootSeparator) {
+        this((rootSeparator == null) ? null : new SerializedString(rootSeparator));
+    }
+
+    /**
+     * Constructor that specifies separator String to use between root values;
+     * if null, no separator is printed.
+     *
+     * @param rootSeparator
+     * @since 2.1
+     */
+    public SingleLinePrettyPrinter(SerializableString rootSeparator) {
+        _rootSeparator = rootSeparator;
+    }
+
+    public SingleLinePrettyPrinter(SingleLinePrettyPrinter base) {
+        this(base, base._rootSeparator);
+    }
+
+    public SingleLinePrettyPrinter(SingleLinePrettyPrinter base, SerializableString rootSeparator) {
+        _arrayIndenter = base._arrayIndenter;
+        _objectIndenter = base._objectIndenter;
+        _spacesInObjectEntries = base._spacesInObjectEntries;
+        _nesting = base._nesting;
+
+        _rootSeparator = rootSeparator;
+    }
+
+    public SingleLinePrettyPrinter withRootSeparator(SerializableString rootSeparator) {
+        if (_rootSeparator == rootSeparator || (rootSeparator != null && rootSeparator.equals(_rootSeparator))) {
+            return this;
+        }
+        return new SingleLinePrettyPrinter(this, rootSeparator);
+    }
+
+    /**
+     * @since 2.6.0
+     */
+    public SingleLinePrettyPrinter withRootSeparator(String rootSeparator) {
+        return withRootSeparator((rootSeparator == null) ? null : new SerializedString(rootSeparator));
+    }
+
+    public void indentArraysWith(Indenter i) {
+        _arrayIndenter = (i == null) ? NopIndenter.instance : i;
+    }
+
+    public void indentObjectsWith(Indenter i) {
+        _objectIndenter = (i == null) ? NopIndenter.instance : i;
+    }
+
+    /**
+     * @deprecated Since 2.3 use {@link #withSpacesInObjectEntries} and {@link #withoutSpacesInObjectEntries()}
+     */
+    @Deprecated
+    public void spacesInObjectEntries(boolean b) {
+        _spacesInObjectEntries = b;
+    }
+
+    /**
+     * @since 2.3
+     */
+    public SingleLinePrettyPrinter withArrayIndenter(Indenter i) {
+        if (i == null) {
+            i = NopIndenter.instance;
+        }
+        if (_arrayIndenter == i) {
+            return this;
+        }
+        SingleLinePrettyPrinter pp = new SingleLinePrettyPrinter(this);
+        pp._arrayIndenter = i;
+        return pp;
+    }
+
+    /**
+     * @since 2.3
+     */
+    public SingleLinePrettyPrinter withObjectIndenter(Indenter i) {
+        if (i == null) {
+            i = NopIndenter.instance;
+        }
+        if (_objectIndenter == i) {
+            return this;
+        }
+        SingleLinePrettyPrinter pp = new SingleLinePrettyPrinter(this);
+        pp._objectIndenter = i;
+        return pp;
+    }
+
+    /**
+     * "Mutant factory" method that will return a pretty printer instance
+     * that does use spaces inside object entries; if 'this' instance already
+     * does this, it is returned; if not, a new instance will be constructed
+     * and returned.
+     *
+     * @since 2.3
+     */
+    public SingleLinePrettyPrinter withSpacesInObjectEntries() {
+        return _withSpaces(true);
+    }
+
+    /**
+     * "Mutant factory" method that will return a pretty printer instance
+     * that does not use spaces inside object entries; if 'this' instance already
+     * does this, it is returned; if not, a new instance will be constructed
+     * and returned.
+     *
+     * @since 2.3
+     */
+    public SingleLinePrettyPrinter withoutSpacesInObjectEntries() {
+        return _withSpaces(false);
+    }
+
+    protected SingleLinePrettyPrinter _withSpaces(boolean state) {
+        if (_spacesInObjectEntries == state) {
+            return this;
+        }
+        SingleLinePrettyPrinter pp = new SingleLinePrettyPrinter(this);
+        pp._spacesInObjectEntries = state;
+        return pp;
+    }
+
+    /*
+    /**********************************************************
+    /* Instantiatable impl
+    /**********************************************************
+     */
+
+    @Override
+    public SingleLinePrettyPrinter createInstance() {
+        return new SingleLinePrettyPrinter(this);
+    }
+
+    /*
+    /**********************************************************
+    /* PrettyPrinter impl
+    /**********************************************************
+     */
+
+    @Override
+    public void writeRootValueSeparator(JsonGenerator jg) throws IOException {
+        if (_rootSeparator != null) {
+            jg.writeRaw(_rootSeparator);
+        }
+    }
+
+    @Override
+    public void writeStartObject(JsonGenerator jg) throws IOException {
+        jg.writeRaw('{');
+        ++_nesting;
+    }
+
+    @Override
+    public void beforeObjectEntries(JsonGenerator jg) throws IOException {
+        _objectIndenter.writeIndentation(jg, _nesting);
+    }
+
+    /**
+     * Method called after an object field has been output, but
+     * before the value is output.
+     * <p>
+     * Default handling (without pretty-printing) will output a single
+     * colon to separate the two. Pretty-printer is
+     * to output a colon as well, but can surround that with other
+     * (white-space) decoration.
+     */
+    @Override
+    public void writeObjectFieldValueSeparator(JsonGenerator jg) throws IOException {
+        if (_spacesInObjectEntries) {
+            jg.writeRaw(": ");
+        } else {
+            jg.writeRaw(':');
+        }
+    }
+
+    /**
+     * Method called after an object entry (field:value) has been completely
+     * output, and before another value is to be output.
+     * <p>
+     * Default handling (without pretty-printing) will output a single
+     * comma to separate the two. Pretty-printer is
+     * to output a comma as well, but can surround that with other
+     * (white-space) decoration.
+     */
+    @Override
+    public void writeObjectEntrySeparator(JsonGenerator jg) throws IOException {
+        jg.writeRaw(',');
+        _objectIndenter.writeIndentation(jg, _nesting);
+    }
+
+    @Override
+    public void writeEndObject(JsonGenerator jg, int nrOfEntries) throws IOException {
+        --_nesting;
+        if (nrOfEntries > 1) {
+            _objectIndenter.writeIndentation(jg, _nesting);
+        } else {
+            jg.writeRaw(' ');
+        }
+        jg.writeRaw('}');
+    }
+
+    @Override
+    public void writeStartArray(JsonGenerator jg) throws IOException {
+        ++_nesting;
+        jg.writeRaw('[');
+    }
+
+    @Override
+    public void beforeArrayValues(JsonGenerator jg) throws IOException {
+        _arrayIndenter.writeIndentation(jg, _nesting);
+    }
+
+    /**
+     * Method called after an array value has been completely
+     * output, and before another value is to be output.
+     * <p>
+     * Default handling (without pretty-printing) will output a single
+     * comma to separate the two. Pretty-printer is
+     * to output a comma as well, but can surround that with other
+     * (white-space) decoration.
+     */
+    @Override
+    public void writeArrayValueSeparator(JsonGenerator gen) throws IOException {
+        gen.writeRaw(',');
+        _arrayIndenter.writeIndentation(gen, _nesting);
+    }
+
+    @Override
+    public void writeEndArray(JsonGenerator gen, int nrOfValues) throws IOException {
+        --_nesting;
+
+        if (_nesting == 0) {
+            gen.writeRaw('\n');
+        }
+        if (nrOfValues > 1) {
+            _arrayIndenter.writeIndentation(gen, _nesting);
+        } else {
+            gen.writeRaw(' ');
+        }
+        gen.writeRaw(']');
+    }
+
+    /*
+    /**********************************************************
+    /* Helper classes
+    /**********************************************************
+     */
+
+    /**
+     * Dummy implementation that adds no indentation whatsoever
+     */
+    public static class NopIndenter implements Indenter, java.io.Serializable {
+        public static final NopIndenter instance = new NopIndenter();
+
+        @Override
+        public void writeIndentation(JsonGenerator jg, int level) throws IOException {
+        }
+
+        @Override
+        public boolean isInline() {
+            return true;
+        }
+    }
+
+    /**
+     * This is a very simple indenter that only adds a
+     * single space for indentation. It is used as the default
+     * indenter for array values.
+     */
+    public static class FixedSpaceIndenter extends NopIndenter {
+        @SuppressWarnings("hiding")
+        public static final FixedSpaceIndenter instance = new FixedSpaceIndenter();
+
+        @Override
+        public void writeIndentation(JsonGenerator jg, int level) throws IOException {
+            jg.writeRaw(' ');
+        }
+
+        @Override
+        public boolean isInline() {
+            return true;
+        }
+    }
+}
diff --git a/asterixdb/asterix-common/src/test/java/org/apache/asterix/test/aql/TestExecutor.java b/asterixdb/asterix-common/src/test/java/org/apache/asterix/test/aql/TestExecutor.java
index bfe0e33..07a7cc5 100644
--- a/asterixdb/asterix-common/src/test/java/org/apache/asterix/test/aql/TestExecutor.java
+++ b/asterixdb/asterix-common/src/test/java/org/apache/asterix/test/aql/TestExecutor.java
@@ -31,18 +31,20 @@
 import java.lang.reflect.Method;
 import java.net.Inet4Address;
 import java.nio.charset.StandardCharsets;
-import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
+import java.util.Arrays;
+import java.util.ArrayList;
 import java.util.concurrent.TimeUnit;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.*;
 import org.apache.asterix.common.config.GlobalConfig;
 import org.apache.asterix.common.utils.ServletUtil.Servlets;
 import org.apache.asterix.test.base.ComparisonException;
@@ -67,9 +69,7 @@
 import org.apache.http.impl.client.StandardHttpRequestRetryHandler;
 import org.apache.http.util.EntityUtils;
 import org.apache.hyracks.util.StorageUtil;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 
 public class TestExecutor {
 
@@ -398,9 +398,10 @@
             try {
                 // First try to parse the response for a JSON error response.
 
-                JSONObject result = new JSONObject(errorBody);
-                String[] errors = { result.getJSONArray("error-code").getString(0), result.getString("summary"),
-                        result.getString("stacktrace") };
+                ObjectMapper om = new ObjectMapper();
+                JsonNode result = om.readTree(errorBody);
+                String[] errors = { result.get("error-code").asText(), result.get("summary").asText(),
+                        result.get("stacktrace").asText() };
                 GlobalConfig.ASTERIX_LOGGER.log(Level.SEVERE, errors[2]);
                 exceptionMsg = "HTTP operation failed: " + errors[0] + "\nSTATUS LINE: " + httpResponse.getStatusLine()
                         + "\nSUMMARY: " + errors[1] + "\nSTACKTRACE: " + errors[2];
@@ -540,15 +541,16 @@
             throw new NullPointerException("Statement parameter required.");
         }
         RequestBuilder builder = RequestBuilder.post(endpoint);
-        JSONObject content = new JSONObject();
-        try {
-            for (CompilationUnit.Parameter param : injectStatement(statement, stmtParam, otherParams)) {
-                content.put(param.getName(), param.getValue());
-            }
-        } catch (JSONException e) {
-            throw new IllegalArgumentException("Request object construction failed.", e);
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode content = om.createObjectNode();
+        for (CompilationUnit.Parameter param : injectStatement(statement, stmtParam, otherParams)) {
+            content.put(param.getName(), param.getValue());
         }
-        builder.setEntity(new StringEntity(content.toString(), ContentType.APPLICATION_JSON));
+        try {
+            builder.setEntity(new StringEntity(om.writeValueAsString(content), ContentType.APPLICATION_JSON));
+        } catch (JsonProcessingException e) {
+            e.printStackTrace();
+        }
         builder.setCharset(StandardCharsets.UTF_8);
         return builder.build();
     }
@@ -1024,11 +1026,11 @@
         StringWriter actual = new StringWriter();
         IOUtils.copy(executeJSONGet, actual, StandardCharsets.UTF_8);
         String config = actual.toString();
-        String nodePid = StringUtils.substringBetween(config, "\"pid\": ", ",").trim();
-        if (nodePid == null) {
-            throw new IllegalArgumentException("Coud not find process for node id: " + nodeId);
+        int nodePid = new ObjectMapper().readValue(config, ObjectNode.class).get("pid").asInt();
+        if (nodePid <= 1) {
+            throw new IllegalArgumentException("Could not retrieve node pid from admin API");
         }
-        ProcessBuilder pb = new ProcessBuilder("kill", "-9", nodePid);
+        ProcessBuilder pb = new ProcessBuilder("kill", "-9", Integer.toString(nodePid));
         pb.start().waitFor();
     }
 
@@ -1122,15 +1124,22 @@
             ArrayList<String> toBeDropped = new ArrayList<>();
             InputStream resultStream = executeQueryService("select dv.DataverseName from Metadata.`Dataverse` as dv;",
                     getEndpoint(Servlets.QUERY_SERVICE));
-            resultStream = ResultExtractor.extract(resultStream);
-            StringWriter sw = new StringWriter();
-            IOUtils.copy(resultStream, sw, StandardCharsets.UTF_8.name());
-            JSONArray result = new JSONArray(sw.toString());
-            for (int i = 0; i < result.length(); ++i) {
-                JSONObject json = result.getJSONObject(i);
-                String dvName = json.getString("DataverseName");
-                if (!dvName.equals("Metadata") && !dvName.equals("Default")) {
-                    toBeDropped.add(dvName);
+            String out = IOUtils.toString(resultStream);
+            ObjectMapper om = new ObjectMapper();
+            om.setConfig(om.getDeserializationConfig().with(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT));
+            JsonNode result;
+            try {
+                result = om.readValue(out, ObjectNode.class).get("results");
+            } catch (JsonMappingException e) {
+                result = om.createArrayNode();
+            }
+            for (int i = 0; i < result.size(); i++) {
+                JsonNode json = result.get(i);
+                if (json != null) {
+                    String dvName = json.get("DataverseName").asText();
+                    if (!dvName.equals("Metadata") && !dvName.equals("Default")) {
+                        toBeDropped.add(dvName);
+                    }
                 }
             }
             if (!toBeDropped.isEmpty()) {
@@ -1151,4 +1160,5 @@
             throw th;
         }
     }
+
 }
diff --git a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/feed/message/EndFeedMessage.java b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/feed/message/EndFeedMessage.java
index 06aafdd..7a3a376 100644
--- a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/feed/message/EndFeedMessage.java
+++ b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/feed/message/EndFeedMessage.java
@@ -18,12 +18,13 @@
  */
 package org.apache.asterix.external.feed.message;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
 import org.apache.asterix.active.EntityId;
 import org.apache.asterix.external.feed.management.FeedConnectionId;
 import org.apache.asterix.external.util.FeedConstants;
 import org.apache.asterix.external.util.FeedUtils.FeedRuntimeType;
-import org.json.JSONException;
-import org.json.JSONObject;
+
+import com.fasterxml.jackson.databind.node.ObjectNode;
 
 /**
  * @deprecated A feed control message indicating the need to end the feed. This message is dispatched
@@ -82,8 +83,9 @@
     }
 
     @Override
-    public JSONObject toJSON() throws JSONException {
-        JSONObject obj = new JSONObject();
+    public ObjectNode toJSON()  {
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode obj = om.createObjectNode();
         obj.put(FeedConstants.MessageConstants.MESSAGE_TYPE, messageType.name());
         obj.put(FeedConstants.MessageConstants.DATAVERSE, connectionId.getFeedId().getDataverse());
         obj.put(FeedConstants.MessageConstants.FEED, connectionId.getFeedId().getEntityName());
diff --git a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/parser/TweetParser.java b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/parser/TweetParser.java
index d23d490..95a5cd1 100644
--- a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/parser/TweetParser.java
+++ b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/parser/TweetParser.java
@@ -18,20 +18,20 @@
  */
 package org.apache.asterix.external.parser;
 
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
 import org.apache.asterix.builders.AbvsBuilderFactory;
 import org.apache.asterix.builders.IARecordBuilder;
 import org.apache.asterix.builders.IAsterixListBuilder;
 import org.apache.asterix.builders.ListBuilderFactory;
-import org.apache.asterix.builders.OrderedListBuilder;
 import org.apache.asterix.builders.RecordBuilderFactory;
+import org.apache.asterix.builders.UnorderedListBuilder;
 import org.apache.asterix.external.api.IRawRecord;
 import org.apache.asterix.external.api.IRecordDataParser;
 import org.apache.asterix.om.base.AMutablePoint;
 import org.apache.asterix.om.base.ANull;
-import org.apache.asterix.om.types.AOrderedListType;
 import org.apache.asterix.om.types.ARecordType;
 import org.apache.asterix.om.types.ATypeTag;
-import org.apache.asterix.om.types.AUnionType;
 import org.apache.asterix.om.types.BuiltinType;
 import org.apache.asterix.om.types.IAType;
 import org.apache.asterix.om.util.container.IObjectPool;
@@ -40,12 +40,10 @@
 import org.apache.hyracks.data.std.api.IMutableValueStorage;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.util.string.UTF8StringWriter;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
 
 import java.io.DataOutput;
 import java.io.IOException;
+import java.util.Iterator;
 
 public class TweetParser extends AbstractDataParser implements IRecordDataParser<String> {
     private final IObjectPool<IARecordBuilder, ATypeTag> recordBuilderPool = new ListObjectPool<>(
@@ -62,121 +60,85 @@
         aPoint = new AMutablePoint(0, 0);
     }
 
-    private void parseJSONArray(JSONArray jArray, DataOutput output, AOrderedListType orderedListType)
-            throws IOException, JSONException {
+    private void parseUnorderedList(JsonNode jArray, DataOutput output) throws IOException {
         ArrayBackedValueStorage itemBuffer = getTempBuffer();
-        OrderedListBuilder orderedList = (OrderedListBuilder) getOrderedListBuilder();
+        UnorderedListBuilder unorderedListBuilder = (UnorderedListBuilder) getUnorderedListBuilder();
 
-        orderedList.reset(orderedListType);
-        for (int iter1 = 0; iter1 < jArray.length(); iter1++) {
+        unorderedListBuilder.reset(null);
+        for (int iter1 = 0; iter1 < jArray.size(); iter1++) {
             itemBuffer.reset();
-            if (writeField(jArray.get(iter1), orderedListType == null ? null : orderedListType.getItemType(),
-                    itemBuffer.getDataOutput())) {
-                orderedList.addItem(itemBuffer);
+            if (writeField(jArray.get(iter1), null, itemBuffer.getDataOutput())) {
+                unorderedListBuilder.addItem(itemBuffer);
             }
         }
-        orderedList.write(output, true);
+        unorderedListBuilder.write(output, true);
     }
 
-    private boolean writeFieldWithFieldType(Object fieldObj, IAType fieldType, DataOutput out)
-            throws HyracksDataException {
+    private boolean writeField(JsonNode fieldObj, IAType fieldType, DataOutput out) throws IOException {
         boolean writeResult = true;
-        IAType chkFieldType;
-        chkFieldType = fieldType instanceof AUnionType ? ((AUnionType) fieldType).getActualType() : fieldType;
-        try {
-            switch (chkFieldType.getTypeTag()) {
+        if (fieldType != null) {
+            switch (fieldType.getTypeTag()) {
                 case STRING:
-                    out.write(fieldType.getTypeTag().serialize());
-                    utf8Writer.writeUTF8(fieldObj.toString(), out);
+                    out.write(BuiltinType.ASTRING.getTypeTag().serialize());
+                    utf8Writer.writeUTF8(fieldObj.asText(), out);
                     break;
                 case INT64:
-                    out.write(fieldType.getTypeTag().serialize());
-                    if (fieldObj instanceof Integer) {
-                        out.writeLong(((Integer) fieldObj).longValue());
-                    } else {
-                        out.writeLong((Long) fieldObj);
-                    }
+                    aInt64.setValue(fieldObj.asLong());
                     int64Serde.serialize(aInt64, out);
                     break;
                 case INT32:
-                    out.write(fieldType.getTypeTag().serialize());
-                    out.writeInt((Integer) fieldObj);
+                    out.write(BuiltinType.AINT32.getTypeTag().serialize());
+                    out.writeInt(fieldObj.asInt());
                     break;
                 case DOUBLE:
-                    out.write(fieldType.getTypeTag().serialize());
-                    out.writeDouble((Double) fieldObj);
+                    out.write(BuiltinType.ADOUBLE.getTypeTag().serialize());
+                    out.writeDouble(fieldObj.asDouble());
                     break;
                 case BOOLEAN:
-                    out.write(fieldType.getTypeTag().serialize());
-                    out.writeBoolean((Boolean) fieldObj);
+                    out.write(BuiltinType.ABOOLEAN.getTypeTag().serialize());
+                    out.writeBoolean(fieldObj.asBoolean());
                     break;
                 case RECORD:
-                    if (((JSONObject) fieldObj).length() != 0) {
-                        writeResult = writeRecord((JSONObject) fieldObj, out, (ARecordType) chkFieldType);
-                    } else {
-                        writeResult = false;
-                    }
-                    break;
-                case ORDEREDLIST:
-                    if (((JSONArray) fieldObj).length() != 0) {
-                        parseJSONArray((JSONArray) fieldObj, out, (AOrderedListType) chkFieldType);
-                    } else {
-                        writeResult = false;
-                    }
+                    writeRecord(fieldObj, out, (ARecordType) fieldType);
                     break;
                 default:
                     writeResult = false;
             }
-        } catch (IOException | JSONException e) {
-            throw new HyracksDataException(e);
-        }
-        return writeResult;
-    }
-
-    private boolean writeFieldWithoutFieldType(Object fieldObj, DataOutput out) throws HyracksDataException {
-        boolean writeResult = true;
-        try {
-            if (fieldObj == JSONObject.NULL) {
+        } else {
+            if (fieldObj.isNull()) {
                 nullSerde.serialize(ANull.NULL, out);
-            } else if (fieldObj instanceof Integer) {
+            } else if (fieldObj.isInt()) {
                 out.write(BuiltinType.AINT32.getTypeTag().serialize());
-                out.writeInt((Integer) fieldObj);
-            } else if (fieldObj instanceof Boolean) {
+                out.writeInt(fieldObj.asInt());
+            } else if (fieldObj.isBoolean()) {
                 out.write(BuiltinType.ABOOLEAN.getTypeTag().serialize());
-                out.writeBoolean((Boolean) fieldObj);
-            } else if (fieldObj instanceof Double) {
+                out.writeBoolean(fieldObj.asBoolean());
+            } else if (fieldObj.isDouble()) {
                 out.write(BuiltinType.ADOUBLE.getTypeTag().serialize());
-                out.writeDouble((Double) fieldObj);
-            } else if (fieldObj instanceof Long) {
+                out.writeDouble(fieldObj.asDouble());
+            } else if (fieldObj.isLong()) {
                 out.write(BuiltinType.AINT64.getTypeTag().serialize());
-                out.writeLong((Long) fieldObj);
-            } else if (fieldObj instanceof String) {
+                out.writeLong(fieldObj.asLong());
+            } else if (fieldObj.isTextual()) {
                 out.write(BuiltinType.ASTRING.getTypeTag().serialize());
-                utf8Writer.writeUTF8((String) fieldObj, out);
-            } else if (fieldObj instanceof JSONArray) {
-                if (((JSONArray) fieldObj).length() != 0) {
-                    parseJSONArray((JSONArray) fieldObj, out, null);
+                utf8Writer.writeUTF8(fieldObj.asText(), out);
+            } else if (fieldObj.isArray()) {
+                if ((fieldObj).size() != 0) {
+                    parseUnorderedList(fieldObj, out);
                 } else {
                     writeResult = false;
                 }
-            } else if (fieldObj instanceof JSONObject) {
-                if (((JSONObject) fieldObj).length() != 0) {
-                    writeResult = writeRecord((JSONObject) fieldObj, out, null);
+            } else if (fieldObj.isObject()) {
+                if ((fieldObj).size() != 0) {
+                    writeRecord(fieldObj, out, null);
                 } else {
                     writeResult = false;
                 }
             }
-        } catch (IOException | JSONException e) {
-            throw new HyracksDataException(e);
         }
         return writeResult;
     }
 
-    private boolean writeField(Object fieldObj, IAType fieldType, DataOutput out) throws HyracksDataException {
-        return fieldType == null ? writeFieldWithoutFieldType(fieldObj, out)
-                : writeFieldWithFieldType(fieldObj, fieldType, out);
-    }
-
     private int checkAttrNameIdx(String[] nameList, String name) {
         int idx = 0;
         if (nameList != null) {
@@ -190,13 +152,11 @@
         return -1;
     }
 
-    public boolean writeRecord(JSONObject obj, DataOutput out, ARecordType curRecType)
-            throws IOException, JSONException {
+    public void writeRecord(JsonNode obj, DataOutput out, ARecordType curRecType) throws IOException {
         IAType[] curTypes = null;
         String[] curFNames = null;
         int fieldN;
         int attrIdx;
-        boolean writeRecord = false;
 
         ArrayBackedValueStorage fieldValueBuffer = getTempBuffer();
         ArrayBackedValueStorage fieldNameBuffer = getTempBuffer();
@@ -216,9 +176,8 @@
             for (int iter1 = 0; iter1 < fieldN; iter1++) {
                 fieldValueBuffer.reset();
                 DataOutput fieldOutput = fieldValueBuffer.getDataOutput();
-                if (obj.isNull(curFNames[iter1])) {
-                    if (curRecType.getFieldType(curFNames[iter1]) != null
-                            && !(curRecType.getFieldType(curFNames[iter1]) instanceof AUnionType)) {
+                if (obj.get(curFNames[iter1]).isNull()) {
+                    if (curRecType.isClosedField(curFNames[iter1])) {
                         throw new HyracksDataException("Closed field " + curFNames[iter1] + " has null value.");
                     } else {
                         continue;
@@ -226,15 +185,18 @@
                 } else {
                     if (writeField(obj.get(curFNames[iter1]), curTypes[iter1], fieldOutput)) {
                         recBuilder.addField(iter1, fieldValueBuffer);
-                        writeRecord = true;
                     }
                 }
             }
         } else {
             //open record type
+            int closedFieldCount = 0;
             IAType curFieldType = null;
-            for (String attrName : JSONObject.getNames(obj)) {
-                if (obj.isNull(attrName) || obj.length() == 0) {
+            String attrName;
+            Iterator<String> iter = obj.fieldNames();
+            while (iter.hasNext()) {
+                attrName = iter.next();
+                if (obj.get(attrName).isNull() || obj.size() == 0) {
                     continue;
                 }
                 attrIdx = checkAttrNameIdx(curFNames, attrName);
@@ -245,29 +207,29 @@
                 fieldNameBuffer.reset();
                 DataOutput fieldOutput = fieldValueBuffer.getDataOutput();
                 if (writeField(obj.get(attrName), curFieldType, fieldOutput)) {
-                    writeRecord = true;
                     if (attrIdx == -1) {
                         aString.setValue(attrName);
                         stringSerde.serialize(aString, fieldNameBuffer.getDataOutput());
                         recBuilder.addField(fieldNameBuffer, fieldValueBuffer);
                     } else {
                         recBuilder.addField(attrIdx, fieldValueBuffer);
+                        closedFieldCount++;
                     }
                 }
             }
+            if (curRecType != null && closedFieldCount < curFNames.length) {
+                throw new HyracksDataException("Non-null field is null");
+            }
         }
-        if (writeRecord) {
-            recBuilder.write(out, true);
-        }
-        return writeRecord;
+        recBuilder.write(out, true);
     }
 
     private IARecordBuilder getRecordBuilder() {
         return recordBuilderPool.allocate(ATypeTag.RECORD);
     }
 
-    private IAsterixListBuilder getOrderedListBuilder() {
-        return listBuilderPool.allocate(ATypeTag.ORDEREDLIST);
+    private IAsterixListBuilder getUnorderedListBuilder() {
+        return listBuilderPool.allocate(ATypeTag.UNORDEREDLIST);
     }
 
     private ArrayBackedValueStorage getTempBuffer() {
@@ -279,9 +241,9 @@
         try {
             //TODO get rid of this temporary json
             resetPools();
-            JSONObject jsObj = new JSONObject(record.get());
-            writeRecord(jsObj, out, recordType);
-        } catch (JSONException | IOException e) {
+            ObjectMapper om = new ObjectMapper();
+            writeRecord(om.readTree(record.get()), out, recordType);
+        } catch (IOException e) {
             throw new HyracksDataException(e);
         }
     }
diff --git a/asterixdb/asterix-installer/src/test/resources/integrationts/replication/results/failback/node_failback/node_failback.cluster_state.10.adm b/asterixdb/asterix-installer/src/test/resources/integrationts/replication/results/failback/node_failback/node_failback.cluster_state.10.adm
index b155305..579caac 100644
--- a/asterixdb/asterix-installer/src/test/resources/integrationts/replication/results/failback/node_failback/node_failback.cluster_state.10.adm
+++ b/asterixdb/asterix-installer/src/test/resources/integrationts/replication/results/failback/node_failback/node_failback.cluster_state.10.adm
@@ -1,10 +1,34 @@
 {
-    "metadata_node": "asterix_nc1",
-    "partitions": {
-        "0": "ID:0, Original Node: asterix_nc1, IODevice: 0, Active Node: asterix_nc1",
-        "1": "ID:1, Original Node: asterix_nc1, IODevice: 1, Active Node: asterix_nc1",
-        "2": "ID:2, Original Node: asterix_nc2, IODevice: 0, Active Node: asterix_nc2",
-        "3": "ID:3, Original Node: asterix_nc2, IODevice: 1, Active Node: asterix_nc2"
+  "metadata_node" : "asterix_nc1",
+  "partitions" : {
+    "0" : {
+      "partitionId" : 0,
+      "nodeId" : "asterix_nc1",
+      "activeNodeId" : "asterix_nc1",
+      "active" : true,
+      "iodeviceNum" : 0
     },
-    "state": "ACTIVE"
+    "1" : {
+      "partitionId" : 1,
+      "nodeId" : "asterix_nc1",
+      "activeNodeId" : "asterix_nc1",
+      "active" : true,
+      "iodeviceNum" : 1
+    },
+    "2" : {
+      "partitionId" : 2,
+      "nodeId" : "asterix_nc2",
+      "activeNodeId" : "asterix_nc2",
+      "active" : true,
+      "iodeviceNum" : 0
+    },
+    "3" : {
+      "partitionId" : 3,
+      "nodeId" : "asterix_nc2",
+      "activeNodeId" : "asterix_nc2",
+      "active" : true,
+      "iodeviceNum" : 1
+    }
+  },
+  "state" : "ACTIVE"
 }
\ No newline at end of file
diff --git a/asterixdb/asterix-installer/src/test/resources/integrationts/replication/results/failback/node_failback/node_failback.cluster_state.5.adm b/asterixdb/asterix-installer/src/test/resources/integrationts/replication/results/failback/node_failback/node_failback.cluster_state.5.adm
index 6b31475..5f58ff7 100644
--- a/asterixdb/asterix-installer/src/test/resources/integrationts/replication/results/failback/node_failback/node_failback.cluster_state.5.adm
+++ b/asterixdb/asterix-installer/src/test/resources/integrationts/replication/results/failback/node_failback/node_failback.cluster_state.5.adm
@@ -1,10 +1,34 @@
 {
-    "metadata_node": "asterix_nc2",
-    "partitions": {
-        "0": "ID:0, Original Node: asterix_nc1, IODevice: 0, Active Node: asterix_nc2",
-        "1": "ID:1, Original Node: asterix_nc1, IODevice: 1, Active Node: asterix_nc2",
-        "2": "ID:2, Original Node: asterix_nc2, IODevice: 0, Active Node: asterix_nc2",
-        "3": "ID:3, Original Node: asterix_nc2, IODevice: 1, Active Node: asterix_nc2"
+  "metadata_node" : "asterix_nc2",
+  "partitions" : {
+    "0" : {
+      "partitionId" : 0,
+      "nodeId" : "asterix_nc1",
+      "activeNodeId" : "asterix_nc2",
+      "active" : true,
+      "iodeviceNum" : 0
     },
-    "state": "ACTIVE"
+    "1" : {
+      "partitionId" : 1,
+      "nodeId" : "asterix_nc1",
+      "activeNodeId" : "asterix_nc2",
+      "active" : true,
+      "iodeviceNum" : 1
+    },
+    "2" : {
+      "partitionId" : 2,
+      "nodeId" : "asterix_nc2",
+      "activeNodeId" : "asterix_nc2",
+      "active" : true,
+      "iodeviceNum" : 0
+    },
+    "3" : {
+      "partitionId" : 3,
+      "nodeId" : "asterix_nc2",
+      "activeNodeId" : "asterix_nc2",
+      "active" : true,
+      "iodeviceNum" : 1
+    }
+  },
+  "state" : "ACTIVE"
 }
\ No newline at end of file
diff --git a/asterixdb/asterix-maven-plugins/record-manager-generator-maven-plugin/pom.xml b/asterixdb/asterix-maven-plugins/record-manager-generator-maven-plugin/pom.xml
index dccbcb1..2fa86b4 100644
--- a/asterixdb/asterix-maven-plugins/record-manager-generator-maven-plugin/pom.xml
+++ b/asterixdb/asterix-maven-plugins/record-manager-generator-maven-plugin/pom.xml
@@ -48,9 +48,12 @@
       <version>2.2.1</version>
     </dependency>
     <dependency>
-      <groupId>org.json</groupId>
-      <artifactId>json</artifactId>
-      <type>jar</type>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-databind</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-core</artifactId>
     </dependency>
   </dependencies>
 </project>
diff --git a/asterixdb/asterix-maven-plugins/record-manager-generator-maven-plugin/src/main/java/org/apache/asterix/recordmanagergenerator/RecordManagerGeneratorMojo.java b/asterixdb/asterix-maven-plugins/record-manager-generator-maven-plugin/src/main/java/org/apache/asterix/recordmanagergenerator/RecordManagerGeneratorMojo.java
index d7479bc..909edc3 100644
--- a/asterixdb/asterix-maven-plugins/record-manager-generator-maven-plugin/src/main/java/org/apache/asterix/recordmanagergenerator/RecordManagerGeneratorMojo.java
+++ b/asterixdb/asterix-maven-plugins/record-manager-generator-maven-plugin/src/main/java/org/apache/asterix/recordmanagergenerator/RecordManagerGeneratorMojo.java
@@ -33,7 +33,6 @@
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
 import org.apache.maven.project.MavenProject;
-import org.json.JSONException;
 
 /**
  * @goal generate-record-manager
@@ -95,8 +94,6 @@
                 type.addToMap(typeMap);
             } catch (FileNotFoundException fnfe) {
                 throw new MojoExecutionException("could not find type description file " + inputFiles[i], fnfe);
-            } catch (JSONException jse) {
-                throw new MojoExecutionException("could not parse type description file " + inputFiles[i], jse);
             } catch (IOException e) {
                 throw new MojoExecutionException("error closing type description file " + inputFiles[i], e);
             }
diff --git a/asterixdb/asterix-maven-plugins/record-manager-generator-maven-plugin/src/main/java/org/apache/asterix/recordmanagergenerator/RecordType.java b/asterixdb/asterix-maven-plugins/record-manager-generator-maven-plugin/src/main/java/org/apache/asterix/recordmanagergenerator/RecordType.java
index 6702a8f..d322371 100644
--- a/asterixdb/asterix-maven-plugins/record-manager-generator-maven-plugin/src/main/java/org/apache/asterix/recordmanagergenerator/RecordType.java
+++ b/asterixdb/asterix-maven-plugins/record-manager-generator-maven-plugin/src/main/java/org/apache/asterix/recordmanagergenerator/RecordType.java
@@ -19,26 +19,41 @@
 
 package org.apache.asterix.recordmanagergenerator;
 
+import java.io.IOException;
 import java.io.Reader;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.Map;
 
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-import org.json.JSONTokener;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 
 public class RecordType {
 
     enum Type {
-        BYTE  (1, "byte",  "get",      "put",      "(byte)0xde",          "TypeUtil.Byte.append",   "TypeUtil.Byte.appendFixed"),
-        SHORT (2, "short", "getShort", "putShort", "(short)0xdead",       "TypeUtil.Short.append",  "TypeUtil.Short.appendFixed"),
-        INT   (4, "int",   "getInt",   "putInt",   "0xdeadbeef",          "TypeUtil.Int.append",    "TypeUtil.Int.appendFixed"),
-        GLOBAL(8, "long",  "getLong",  "putLong",  "0xdeadbeefdeadbeefl", "TypeUtil.Global.append", "TypeUtil.Global.appendFixed");
+        BYTE(1, "byte", "get", "put", "(byte)0xde", "TypeUtil.Byte.append", "TypeUtil.Byte.appendFixed"),
+        SHORT(
+                2,
+                "short",
+                "getShort",
+                "putShort",
+                "(short)0xdead",
+                "TypeUtil.Short.append",
+                "TypeUtil.Short.appendFixed"),
+        INT(4, "int", "getInt", "putInt", "0xdeadbeef", "TypeUtil.Int.append", "TypeUtil.Int.appendFixed"),
+        GLOBAL(
+                8,
+                "long",
+                "getLong",
+                "putLong",
+                "0xdeadbeefdeadbeefl",
+                "TypeUtil.Global.append",
+                "TypeUtil.Global.appendFixed");
 
-        Type(int size, String javaType, String bbGetter, String bbSetter, String deadMemInitializer, String appender, String tabAppender) {
+        Type(int size, String javaType, String bbGetter, String bbSetter, String deadMemInitializer, String appender,
+                String tabAppender) {
             this.size = size;
             this.javaType = javaType;
             this.bbGetter = bbGetter;
@@ -73,10 +88,10 @@
             this.accessible = accessible;
         }
 
-        public static Field fromJSON(JSONObject obj) throws JSONException {
-            String name = obj.getString("name");
-            Type type = parseType(obj.getString("type"));
-            String initial = obj.optString("initial", null);
+        public static Field fromJSON(JsonNode obj) {
+            String name = obj.get("name").asText();
+            Type type = parseType(obj.get("type").asText());
+            String initial = obj.get("initial") == null ? null : obj.get("initial").asText();
             return new Field(name, type, initial, -1, true);
         }
 
@@ -96,7 +111,7 @@
 
         String methodName(String prefix) {
             String words[] = name.split(" ");
-            assert(words.length > 0);
+            assert words.length > 0;
             StringBuilder sb = new StringBuilder(prefix);
             for (int j = 0; j < words.length; ++j) {
                 String word = words[j];
@@ -108,11 +123,8 @@
 
         StringBuilder appendMemoryManagerGetMethod(StringBuilder sb, String indent, int level) {
             sb = indent(sb, indent, level);
-            sb.append("public ")
-              .append(type.javaType)
-              .append(' ')
-              .append(methodName("get"))
-              .append("(int slotNum) {\n");
+            sb.append("public ").append(type.javaType).append(' ').append(methodName("get"))
+                    .append("(int slotNum) {\n");
             sb = indent(sb, indent, level + 1);
             sb.append("final Buffer buf = buffers.get(slotNum / NO_SLOTS);\n");
             sb = indent(sb, indent, level + 1);
@@ -120,11 +132,8 @@
             sb = indent(sb, indent, level + 1);
             sb.append("final ByteBuffer b = buf.bb;\n");
             sb = indent(sb, indent, level + 1);
-            sb.append("return b.")
-              .append(type.bbGetter)
-              .append("((slotNum % NO_SLOTS) * ITEM_SIZE + ")
-              .append(offsetName())
-              .append(");\n");
+            sb.append("return b.").append(type.bbGetter).append("((slotNum % NO_SLOTS) * ITEM_SIZE + ")
+                    .append(offsetName()).append(");\n");
             sb = indent(sb, indent, level);
             sb.append("}\n");
             return sb;
@@ -132,19 +141,13 @@
 
         StringBuilder appendMemoryManagerSetMethod(StringBuilder sb, String indent, int level) {
             sb = indent(sb, indent, level);
-            sb.append("public void ")
-              .append(methodName("set"))
-              .append("(int slotNum, ")
-              .append(type.javaType)
-              .append(" value) {\n");
+            sb.append("public void ").append(methodName("set")).append("(int slotNum, ").append(type.javaType)
+                    .append(" value) {\n");
             sb = indent(sb, indent, level + 1);
             sb.append("final ByteBuffer b = buffers.get(slotNum / NO_SLOTS).bb;\n");
             sb = indent(sb, indent, level + 1);
-            sb.append("b.")
-              .append(type.bbSetter)
-              .append("((slotNum % NO_SLOTS) * ITEM_SIZE + ")
-              .append(offsetName())
-              .append(", value);\n");
+            sb.append("b.").append(type.bbSetter).append("((slotNum % NO_SLOTS) * ITEM_SIZE + ").append(offsetName())
+                    .append(", value);\n");
             sb = indent(sb, indent, level);
             sb.append("}\n");
             return sb;
@@ -152,23 +155,18 @@
 
         StringBuilder appendArenaManagerGetMethod(StringBuilder sb, String indent, int level) {
             sb = indent(sb, indent, level);
-            sb.append("public ")
-              .append(type.javaType)
-              .append(' ')
-              .append(methodName("get"))
-              .append("(long slotNum) {\n");
+            sb.append("public ").append(type.javaType).append(' ').append(methodName("get"))
+                    .append("(long slotNum) {\n");
             if (initial != null) {
-              sb = indent(sb, indent, level + 1);
-              sb.append("if (TRACK_ALLOC_ID) checkAllocId(slotNum);\n");
+                sb = indent(sb, indent, level + 1);
+                sb.append("if (TRACK_ALLOC_ID) checkAllocId(slotNum);\n");
             }
             sb = indent(sb, indent, level + 1);
             sb.append("final int arenaId = TypeUtil.Global.arenaId(slotNum);\n");
             sb = indent(sb, indent, level + 1);
             sb.append("final int localId = TypeUtil.Global.localId(slotNum);\n");
             sb = indent(sb, indent, level + 1);
-            sb.append("return get(arenaId).")
-              .append(methodName("get"))
-              .append("(localId);\n");
+            sb.append("return get(arenaId).").append(methodName("get")).append("(localId);\n");
             sb = indent(sb, indent, level);
             sb.append("}\n");
             return sb;
@@ -176,23 +174,18 @@
 
         StringBuilder appendArenaManagerSetMethod(StringBuilder sb, String indent, int level) {
             sb = indent(sb, indent, level);
-            sb.append("public void ")
-              .append(methodName("set"))
-              .append("(long slotNum, ")
-              .append(type.javaType)
-              .append(" value) {\n");
+            sb.append("public void ").append(methodName("set")).append("(long slotNum, ").append(type.javaType)
+                    .append(" value) {\n");
             if (initial != null) {
-              sb = indent(sb, indent, level + 1);
-              sb.append("if (TRACK_ALLOC_ID) checkAllocId(slotNum);\n");
+                sb = indent(sb, indent, level + 1);
+                sb.append("if (TRACK_ALLOC_ID) checkAllocId(slotNum);\n");
             }
             sb = indent(sb, indent, level + 1);
             sb.append("final int arenaId = TypeUtil.Global.arenaId(slotNum);\n");
             sb = indent(sb, indent, level + 1);
             sb.append("final int localId = TypeUtil.Global.localId(slotNum);\n");
             sb = indent(sb, indent, level + 1);
-            sb.append("get(arenaId).")
-              .append(methodName("set"))
-              .append("(localId, value);\n");
+            sb.append("get(arenaId).").append(methodName("set")).append("(localId, value);\n");
             sb = indent(sb, indent, level);
             sb.append("}\n");
             return sb;
@@ -200,11 +193,7 @@
 
         StringBuilder appendInitializers(StringBuilder sb, String indent, int level) {
             sb = indent(sb, indent, level);
-            sb.append("bb.")
-              .append(type.bbSetter)
-              .append("(slotNum * ITEM_SIZE + ")
-              .append(offsetName())
-              .append(", ");
+            sb.append("bb.").append(type.bbSetter).append("(slotNum * ITEM_SIZE + ").append(offsetName()).append(", ");
             if (initial != null) {
                 sb.append(initial);
             } else {
@@ -219,17 +208,11 @@
                 return sb;
             }
             sb = indent(sb, indent, level);
-            sb.append("if (bb.")
-              .append(type.bbGetter)
-              .append("(itemOffset + ")
-              .append(offsetName())
-              .append(") == ")
-              .append(type.deadMemInitializer)
-              .append(") {\n");
+            sb.append("if (bb.").append(type.bbGetter).append("(itemOffset + ").append(offsetName()).append(") == ")
+                    .append(type.deadMemInitializer).append(") {\n");
             sb = indent(sb, indent, level + 1);
-            sb.append("String msg = \"invalid value in field ")
-              .append(offsetName())
-              .append(" of slot \" + TypeUtil.Global.toString(slotNum);\n");
+            sb.append("String msg = \"invalid value in field ").append(offsetName())
+                    .append(" of slot \" + TypeUtil.Global.toString(slotNum);\n");
             sb = indent(sb, indent, level + 1);
             sb.append("throw new IllegalStateException(msg);\n");
             sb = indent(sb, indent, level);
@@ -239,7 +222,7 @@
 
         String offsetName() {
             String words[] = name.split(" ");
-            assert(words.length > 0);
+            assert (words.length > 0);
             StringBuilder sb = new StringBuilder(words[0].toUpperCase());
             for (int j = 1; j < words.length; ++j) {
                 sb.append("_").append(words[j].toUpperCase());
@@ -271,18 +254,17 @@
         addField("next free slot", Type.INT, "-1", false);
     }
 
-    public static RecordType read(Reader reader) throws JSONException {
-        JSONTokener tok = new JSONTokener(reader);
-        JSONObject obj = new JSONObject(tok);
-        return fromJSON(obj);
+    public static RecordType read(Reader reader) throws IOException {
+        ObjectNode node = new ObjectMapper().readValue(reader, ObjectNode.class);
+        return fromJSON(node);
     }
 
-    public static RecordType fromJSON(JSONObject obj) throws JSONException {
-        RecordType result = new RecordType(obj.getString("name"));
-        JSONArray fields = obj.getJSONArray("fields");
-        for (int i = 0; i < fields.length(); ++i) {
-            JSONObject field = fields.getJSONObject(i);
-            result.fields.add(Field.fromJSON(field));
+    public static RecordType fromJSON(ObjectNode obj) {
+        RecordType result = new RecordType(obj.get("name").asText());
+        JsonNode fields = obj.get("fields");
+        for (int i = 0; i < fields.size(); i++) {
+            JsonNode n = fields.get(i);
+            result.fields.add(Field.fromJSON(n));
         }
         return result;
     }
@@ -298,7 +280,7 @@
     }
 
     private void addField(String name, Type type, String initial, boolean accessible) {
-        if (! modifiable) {
+        if (!modifiable) {
             throw new IllegalStateException("cannot modify type anmore");
         }
         fields.add(new Field(name, type, initial, -1, accessible));
@@ -319,7 +301,9 @@
             field.offset = totalSize;
             final int size = field.type.size;
             totalSize += size;
-            if (size > alignment) alignment = size;
+            if (size > alignment) {
+                alignment = size;
+            }
         }
         if (totalSize % alignment != 0) {
             totalSize = ((totalSize / alignment) + 1) * alignment;
@@ -340,17 +324,12 @@
 
     StringBuilder appendConstants(StringBuilder sb, String indent, int level) {
         sb = indent(sb, indent, level);
-        sb.append("public static int ITEM_SIZE = ")
-          .append(totalSize)
-          .append(";\n");
+        sb.append("public static int ITEM_SIZE = ").append(totalSize).append(";\n");
         for (int i = 0; i < fields.size(); ++i) {
             final Field field = fields.get(i);
             sb = indent(sb, indent, level);
-            sb.append("public static int ")
-              .append(field.offsetName())
-              .append(" = ")
-              .append(field.offset).append("; // size: ")
-              .append(field.type.size).append("\n");
+            sb.append("public static int ").append(field.offsetName()).append(" = ").append(field.offset)
+                    .append("; // size: ").append(field.type.size).append("\n");
         }
         return sb;
     }
@@ -366,22 +345,14 @@
         for (int i = 0; i < fields.size(); ++i) {
             final Field field = fields.get(i);
             sb = indent(sb, indent, level);
-            sb.append("sb.append(\"")
-              .append(padRight(field.name, maxNameWidth))
-              .append(" | \");\n");
+            sb.append("sb.append(\"").append(padRight(field.name, maxNameWidth)).append(" | \");\n");
             sb = indent(sb, indent, level);
             sb.append("for (int i = 0; i < NO_SLOTS; ++i) {\n");
             sb = indent(sb, indent, level + 1);
-            sb.append(field.type.javaType)
-              .append(" value = bb.")
-              .append(field.type.bbGetter)
-              .append("(i * ITEM_SIZE + ")
-              .append(field.offsetName())
-              .append(");\n");
+            sb.append(field.type.javaType).append(" value = bb.").append(field.type.bbGetter)
+                    .append("(i * ITEM_SIZE + ").append(field.offsetName()).append(");\n");
             sb = indent(sb, indent, level + 1);
-            sb.append("sb = ")
-              .append(field.type.tabAppender)
-              .append("(sb, value);\n");
+            sb.append("sb = ").append(field.type.tabAppender).append("(sb, value);\n");
             sb = indent(sb, indent, level + 1);
             sb.append("sb.append(\" | \");\n");
             sb = indent(sb, indent, level);
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ABinary.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ABinary.java
index b3ee50e..db87ce0 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ABinary.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ABinary.java
@@ -18,13 +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.BuiltinType;
 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 ABinary implements IAObject {
 
@@ -115,15 +115,16 @@
     }
 
     @Override
-    public JSONObject toJSON() throws JSONException {
-        JSONObject json = new JSONObject();
+    public ObjectNode toJSON()  {
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode json = om.createObjectNode();
 
         int start = getStart();
-        JSONArray byteArray = new JSONArray();
+        ArrayNode byteArray = om.createArrayNode();
         for (int i = 0; i < getLength(); i++) {
-            byteArray.put(bytes[start + i]);
+            byteArray.add(bytes[start + i]);
         }
-        json.put("ABinary", byteArray);
+        json.set("ABinary", byteArray);
 
         return json;
     }
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ABitArray.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ABitArray.java
index 503c920..a15dbad 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ABitArray.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ABitArray.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;
@@ -139,14 +139,15 @@
     }
 
     @Override
-    public JSONObject toJSON() throws JSONException {
-        JSONObject json = new JSONObject();
+    public ObjectNode toJSON()  {
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode json = om.createObjectNode();
 
-        JSONArray bitArray = new JSONArray();
+        ArrayNode bitArray = om.createArrayNode();
         for (int i = 0; i < intArray.length; i++) {
-            bitArray.put(intArray[i]);
+            bitArray.add(intArray[i]);
         }
-        json.put("ABitArray", bitArray);
+        json.set("ABitArray", bitArray);
 
         return json;
     }
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ABoolean.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ABoolean.java
index 2a56cff..a1011d8 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ABoolean.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ABoolean.java
@@ -18,12 +18,12 @@
  */
 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.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 final class ABoolean implements IAObject {
 
@@ -80,7 +80,7 @@
     }
 
     @Override
-    public JSONObject toJSON() throws JSONException {
-        return new JSONObject().put("ABoolean", bVal);
+    public ObjectNode toJSON()  {
+        return new ObjectMapper().createObjectNode().put("ABoolean", bVal);
     }
 }
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ACircle.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ACircle.java
index a99bcda..4878d7a 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ACircle.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ACircle.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;
@@ -82,13 +82,14 @@
     }
 
     @Override
-    public JSONObject toJSON() throws JSONException {
-        JSONObject json = new JSONObject();
+    public ObjectNode toJSON()  {
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode json = om.createObjectNode();
 
-        JSONObject circle = new JSONObject();
-        circle.put("center", center);
+        ObjectNode circle = om.createObjectNode();
+        circle.set("center", center.toJSON());
         circle.put("radius", radius);
-        json.put("ACircle", circle);
+        json.set("ACircle", circle);
 
         return json;
     }
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ADate.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ADate.java
index 789ad31..9373f90 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ADate.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ADate.java
@@ -20,8 +20,8 @@
 
 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;
@@ -96,8 +96,9 @@
     }
 
     @Override
-    public JSONObject toJSON() throws JSONException {
-        JSONObject json = new JSONObject();
+    public ObjectNode toJSON()  {
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode json = om.createObjectNode();
 
         json.put("ADate", chrononTimeInDay);
 
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ADateTime.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ADateTime.java
index f3592e3..75f653e 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ADateTime.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ADateTime.java
@@ -20,13 +20,13 @@
 
 import java.io.IOException;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
 import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.om.base.temporal.GregorianCalendarSystem;
 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;
 
 /**
  * ADateTime type represents the timestamp values.
@@ -136,8 +136,9 @@
     }
 
     @Override
-    public JSONObject toJSON() throws JSONException {
-        JSONObject json = new JSONObject();
+    public ObjectNode toJSON()  {
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode json = om.createObjectNode();
 
         json.put("ADateTime", chrononTime);
 
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ADayTimeDuration.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ADayTimeDuration.java
index cb298b7..d31b8c8 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ADayTimeDuration.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ADayTimeDuration.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;
@@ -42,12 +43,13 @@
      * @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("milliseconds", chrononInMillisecond);
-        json.put("ADuration", duration);
+        json.set("ADuration", duration);
 
         return json;
     }
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ADouble.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ADouble.java
index 4746773..7a2fe06 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ADouble.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ADouble.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;
@@ -78,8 +79,9 @@
     }
 
     @Override
-    public JSONObject toJSON() throws JSONException {
-        JSONObject json = new JSONObject();
+    public ObjectNode toJSON()  {
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode json = om.createObjectNode();
 
         json.put("ADouble", value);
 
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ADuration.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ADuration.java
index 27b551b..a3f23d3 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ADuration.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ADuration.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.base.temporal.GregorianCalendarSystem;
@@ -117,13 +118,14 @@
     }
 
     @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);
         duration.put("milliseconds", chrononInMillisecond);
-        json.put("ADuration", duration);
+        json.set("ADuration", duration);
 
         return json;
     }
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/AFloat.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/AFloat.java
index 50d1825..f29e659 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/AFloat.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/AFloat.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;
@@ -78,8 +79,9 @@
     }
 
     @Override
-    public JSONObject toJSON() throws JSONException {
-        JSONObject json = new JSONObject();
+    public ObjectNode toJSON()  {
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode json = om.createObjectNode();
 
         json.put("AFloat", value);
 
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/AInt16.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/AInt16.java
index 11dd486..934ef0a 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/AInt16.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/AInt16.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;
@@ -68,8 +69,10 @@
     }
 
     @Override
-    public JSONObject toJSON() throws JSONException {
-        JSONObject json = new JSONObject();
+    public ObjectNode toJSON()  {
+
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode json = om.createObjectNode();
 
         json.put("AInt16", value);
 
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/AInt32.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/AInt32.java
index 5bbcf77..38a87d7 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/AInt32.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/AInt32.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;
@@ -93,8 +94,9 @@
     }
 
     @Override
-    public JSONObject toJSON() throws JSONException {
-        JSONObject json = new JSONObject();
+    public ObjectNode toJSON()  {
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode json = om.createObjectNode();
 
         json.put("AInt32", value);
 
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/AInt64.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/AInt64.java
index 9047833..02bc8b0 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/AInt64.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/AInt64.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;
@@ -67,8 +68,9 @@
     }
 
     @Override
-    public JSONObject toJSON() throws JSONException {
-        JSONObject json = new JSONObject();
+    public ObjectNode toJSON()  {
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode json = om.createObjectNode();
 
         json.put("AInt64", value);
 
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/AInt8.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/AInt8.java
index 8360d99..5623d37 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/AInt8.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/AInt8.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;
@@ -67,8 +68,9 @@
     }
 
     @Override
-    public JSONObject toJSON() throws JSONException {
-        JSONObject json = new JSONObject();
+    public ObjectNode toJSON()  {
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode json = om.createObjectNode();
 
         json.put("AInt8", value);
 
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/AInterval.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/AInterval.java
index 5fa99a9..9dfaf3b 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/AInterval.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/AInterval.java
@@ -20,8 +20,7 @@
 
 import java.io.IOException;
 
-import org.json.JSONException;
-import org.json.JSONObject;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 
 import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.om.base.temporal.GregorianCalendarSystem;
@@ -156,7 +155,7 @@
     }
 
     @Override
-    public JSONObject toJSON() throws JSONException {
+    public ObjectNode toJSON()  {
         // TODO(madhusudancs): Remove this method when a printer based JSON serializer is implemented.
         return null;
     }
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ALine.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ALine.java
index 4908fa8..9134a3c 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ALine.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ALine.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 @@
     }
 
     @Override
-    public JSONObject toJSON() throws JSONException {
-        JSONObject json = new JSONObject();
+    public ObjectNode toJSON()  {
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode json = om.createObjectNode();
 
-        JSONObject line = new JSONObject();
-        line.put("p1", p1);
-        line.put("p2", p2);
-        json.put("ALine", line);
+        ObjectNode line = om.createObjectNode();
+        line.set("p1", p1.toJSON());
+        line.set("p2", p2.toJSON());
+        json.set("ALine", line);
 
         return json;
     }
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/AMissing.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/AMissing.java
index 6c357e6..2455311 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/AMissing.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/AMissing.java
@@ -18,12 +18,12 @@
  */
 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.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;
 
 // This class represents a MISSING object.
 public class AMissing implements IAObject {
@@ -59,8 +59,9 @@
     }
 
     @Override
-    public JSONObject toJSON() throws JSONException {
-        JSONObject json = new JSONObject();
+    public ObjectNode toJSON()  {
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode json = om.createObjectNode();
 
         json.put("AMissing", "missing");
 
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ANull.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ANull.java
index 859ebb3..ebf7975 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ANull.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/ANull.java
@@ -19,12 +19,12 @@
 
 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.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 ANull implements IAObject {
 
@@ -59,8 +59,9 @@
     }
 
     @Override
-    public JSONObject toJSON() throws JSONException {
-        JSONObject json = new JSONObject();
+    public ObjectNode toJSON()  {
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode json = om.createObjectNode();
         json.put("ANull", "null");
         return json;
     }
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/AOrderedList.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/AOrderedList.java
index 7e67e0a..8138a51 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/AOrderedList.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/base/AOrderedList.java
@@ -21,14 +21,14 @@
 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.AOrderedListType;
 import org.apache.asterix.om.types.BuiltinType;
 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 AOrderedList implements IACollection {
 
@@ -126,14 +126,15 @@
     }
 
     @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("AOrderedList", list);
+        json.set("AOrderedList", list);
 
         return json;
     }
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 @@
     }
 
     @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;
     }
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 @@
     }
 
     @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;
     }
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 @@
     }
 
     @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;
     }
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 @@
     }
 
     @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;
     }
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 @@
     }
 
     @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;
     }
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 @@
 
 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 @@
     }
 
     @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);
 
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 @@
 
 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 @@
     }
 
     @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);
 
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.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 @@
     }
 
     @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;
     }
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 @@
 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 @@
     }
 
     @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;
     }
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 @@
      * @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;
     }
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 @@
     }
 
     @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);
 
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 @@
     }
 
     @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;
     }
 }
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.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 @@
     }
 
     @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 @@
             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;
     }
 
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.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 @@
     }
 
     @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;
     }
 }
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 @@
     }
 
     @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;
     }
 }
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 @@
         }
 
         @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 @@
         }
 
         @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 @@
         }
 
         @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 @@
         }
 
         @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 @@
         }
 
         @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 @@
         }
 
         @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 @@
         }
 
         @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 @@
         }
 
         @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 @@
         }
 
         @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 @@
         }
 
         @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 @@
         }
 
         @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 @@
         }
 
         @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 @@
         }
 
         @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 @@
         }
 
         @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 @@
         }
 
         @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 @@
         }
 
         @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 @@
         }
 
         @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 @@
         }
 
         @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 @@
         }
 
         @Override
-        public JSONObject toJSON() throws JSONException {
+        public ObjectNode toJSON() {
             return null;
         }
     };
@@ -574,8 +592,9 @@
         }
 
         @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 @@
         }
 
         @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 @@
         }
 
         @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 @@
         }
 
         @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 @@
         }
 
         @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 @@
         }
 
         @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 @@
         }
 
         @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 @@
         }
 
         @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 @@
         }
 
         @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 @@
         }
 
         @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;
         }
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.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 @@
      * @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 @@
 
         // 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);
         }
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.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.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 @@
         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 @@
                     : 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;
     }
 }
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>
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>
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.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 @@
     }
 
     @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 @@
             sb.append("  " + f.toString() + ";\n");
         }
         sb.append("}");
-        // sb.append(super.getInputArity());
-        // sb.append(";");
-        // sb.append(super.getOutputArity());
-        // sb.append(";");
         return sb.toString();
     }
 
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>
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>
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.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 @@
         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;
     }
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 @@
 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.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 @@
      * Translate this connector descriptor to JSON.
      *
      * @return
-     * @throws JSONException
      */
-    public JSONObject toJSON() throws JSONException;
+    public JsonNode toJSON();
 
     /**
      * Sets the connector Id
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 @@
 
 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 @@
     /**
      * Translates this operator descriptor to JSON.
      */
-    public JSONObject toJSON() throws JSONException;
+    public ObjectNode toJSON();
 }
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() ;
 }
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.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 @@
         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;
     }
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.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 @@
         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;
     }
 }
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.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.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 @@
     }
 
     @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 @@
                             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 @@
                 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;
     }
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>
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.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 java.util.*;
 
-import org.json.simple.JSONArray;
-import org.json.simple.JSONObject;
-import org.json.simple.parser.JSONParser;
-
+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 @@
  */
 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 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 @@
             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 @@
      * @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 @@
         }
     }
 
-    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 @@
         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;
     }
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>
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.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.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 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 @@
         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 @@
             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;
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/adminconsole/pages/IndexPage.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/adminconsole/pages/IndexPage.java
index 32ac3f5..680c2a7 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/adminconsole/pages/IndexPage.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/adminconsole/pages/IndexPage.java
@@ -18,22 +18,23 @@
  */
 package org.apache.hyracks.control.cc.adminconsole.pages;
 
+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.wicket.markup.html.basic.Label;
 import org.apache.wicket.markup.html.link.BookmarkablePageLink;
 import org.apache.wicket.markup.html.list.ListItem;
 import org.apache.wicket.markup.html.list.ListView;
 import org.apache.wicket.request.mapper.parameter.PageParameters;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
 
 import org.apache.hyracks.control.cc.ClusterControllerService;
-import org.apache.hyracks.control.cc.web.util.JSONUtils;
 import org.apache.hyracks.control.cc.work.GetJobSummariesJSONWork;
 import org.apache.hyracks.control.cc.work.GetNodeSummariesJSONWork;
 
 import java.text.SimpleDateFormat;
 import java.util.Date;
+import java.util.List;
 
 public class IndexPage extends AbstractPage {
     private static final long serialVersionUID = 1L;
@@ -43,49 +44,42 @@
 
         GetNodeSummariesJSONWork gnse = new GetNodeSummariesJSONWork(ccs);
         ccs.getWorkQueue().scheduleAndSync(gnse);
-        JSONArray nodeSummaries = gnse.getSummaries();
-        add(new Label("node-count", String.valueOf(nodeSummaries.length())));
-        ListView<JSONObject> nodeList = new ListView<JSONObject>("node-list", JSONUtils.toList(nodeSummaries)) {
+        ArrayNode nodeSummaries = gnse.getSummaries();
+        add(new Label("node-count", String.valueOf(nodeSummaries.size())));
+        ListView<JsonNode> nodeList = new ListView<JsonNode>("node-list",
+                Lists.newArrayList(nodeSummaries.iterator())) {
             private static final long serialVersionUID = 1L;
 
             @Override
-            protected void populateItem(ListItem<JSONObject> item) {
-                JSONObject o = item.getModelObject();
-                try {
-                    item.add(new Label("node-id", o.getString("node-id")));
-                    item.add(new Label("heap-used", o.getString("heap-used")));
-                    item.add(new Label("system-load-average", o.getString("system-load-average")));
-                    PageParameters params = new PageParameters();
-                    params.add("node-id", o.getString("node-id"));
-                    item.add(new BookmarkablePageLink<Object>("node-details", NodeDetailsPage.class, params));
-                } catch (JSONException e) {
-                    throw new RuntimeException(e);
-                }
+            protected void populateItem(ListItem<JsonNode> item) {
+                JsonNode o = item.getModelObject();
+                item.add(new Label("node-id", o.get("node-id").asText()));
+                item.add(new Label("heap-used", o.get("heap-used").asText()));
+                item.add(new Label("system-load-average", o.get("system-load-average").asText()));
+                PageParameters params = new PageParameters();
+                params.add("node-id", o.get("node-id").asText());
+                item.add(new BookmarkablePageLink<Object>("node-details", NodeDetailsPage.class, params));
             }
         };
         add(nodeList);
 
         GetJobSummariesJSONWork gjse = new GetJobSummariesJSONWork(ccs);
         ccs.getWorkQueue().scheduleAndSync(gjse);
-        JSONArray jobSummaries = gjse.getSummaries();
-        ListView<JSONObject> jobList = new ListView<JSONObject>("jobs-list", JSONUtils.toList(jobSummaries)) {
+        ArrayNode jobSummaries = gjse.getSummaries();
+        ListView<JsonNode> jobList = new ListView<JsonNode>("jobs-list", Lists.newArrayList(jobSummaries.iterator())) {
             private static final long serialVersionUID = 1L;
 
             @Override
-            protected void populateItem(ListItem<JSONObject> item) {
-                JSONObject o = item.getModelObject();
-                try {
-                    item.add(new Label("job-id", o.getString("job-id")));
-                    item.add(new Label("status", o.getString("status")));
-                    item.add(new Label("create-time", longToDateString(Long.parseLong(o.getString("create-time")))));
-                    item.add(new Label("start-time", longToDateString(Long.parseLong(o.getString("start-time")))));
-                    item.add(new Label("end-time", longToDateString(Long.parseLong(o.getString("end-time")))));
-                    PageParameters params = new PageParameters();
-                    params.add("job-id", o.getString("job-id"));
-                    item.add(new BookmarkablePageLink<Object>("job-details", JobDetailsPage.class, params));
-                } catch (JSONException e) {
-                    throw new RuntimeException(e);
-                }
+            protected void populateItem(ListItem<JsonNode> item) {
+                JsonNode o = item.getModelObject();
+                item.add(new Label("job-id", o.get("job-id").asText()));
+                item.add(new Label("status", o.get("status").asText()));
+                item.add(new Label("create-time", longToDateString(Long.parseLong(o.get("create-time").asText()))));
+                item.add(new Label("start-time", longToDateString(Long.parseLong(o.get("start-time").asText()))));
+                item.add(new Label("end-time", longToDateString(Long.parseLong(o.get("end-time").asText()))));
+                PageParameters params = new PageParameters();
+                params.add("job-id", o.get("job-id"));
+                item.add(new BookmarkablePageLink<Object>("job-details", JobDetailsPage.class, params));
             }
         };
         add(jobList);
@@ -99,4 +93,4 @@
         Date date = new Date(milliseconds);
         return sdf.format(date);
     }
-}
\ No newline at end of file
+}
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/adminconsole/pages/JobDetailsPage.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/adminconsole/pages/JobDetailsPage.java
index 7898122..abc07d9 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/adminconsole/pages/JobDetailsPage.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/adminconsole/pages/JobDetailsPage.java
@@ -26,11 +26,12 @@
 import java.util.List;
 import java.util.Map;
 
+import com.fasterxml.jackson.databind.JsonNode;
 import org.apache.wicket.markup.html.basic.Label;
 import org.apache.wicket.request.mapper.parameter.PageParameters;
 import org.apache.wicket.util.string.StringValue;
-import org.json.JSONArray;
-import org.json.JSONObject;
+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.TaskAttemptId;
@@ -58,19 +59,19 @@
         jag.setEscapeModelStrings(false);
         add(jag);
 
-        JSONObject jagO = gacgw.getJSON();
+        ObjectNode jagO = gacgw.getJSON();
 
         Map<ActivityId, String> activityMap = new HashMap<ActivityId, String>();
         if (jagO.has("activity-clusters")) {
-            JSONArray acArray = jagO.getJSONArray("activity-clusters");
-            for (int j = 0; j < acArray.length(); ++j) {
-                JSONObject acO = acArray.getJSONObject(j);
+            JsonNode acArray = jagO.get("activity-clusters");
+            for (int j = 0; j < acArray.size(); ++j) {
+                JsonNode acO = acArray.get(j);
                 if (acO.has("activities")) {
-                    JSONArray aArray = acO.getJSONArray("activities");
-                    for (int i = 0; i < aArray.length(); ++i) {
-                        JSONObject aO = aArray.getJSONObject(i);
-                        ActivityId aid = ActivityId.parse(aO.getString("id"));
-                        String className = aO.getString("java-class");
+                    JsonNode aArray = acO.get("activities");
+                    for (int i = 0; i < aArray.size(); ++i) {
+                        JsonNode aO = aArray.get(i);
+                        ActivityId aid = ActivityId.parse(aO.get("id").asText());
+                        String className = aO.get("java-class").asText();
 
                         activityMap.put(aid, className);
                     }
@@ -84,30 +85,30 @@
         jobrun.setEscapeModelStrings(false);
         add(jobrun);
 
-        JSONObject jrO = gjrw.getJSON();
+        ObjectNode jrO = gjrw.getJSON();
 
         List<TaskClusterAttempt[]> tcList = new ArrayList<TaskClusterAttempt[]>();
         long minTime = Long.MAX_VALUE;
         long maxTime = Long.MIN_VALUE;
         if (jrO.has("activity-clusters")) {
-            JSONArray acA = jrO.getJSONArray("activity-clusters");
-            for (int i = 0; i < acA.length(); ++i) {
-                JSONObject acO = acA.getJSONObject(i);
+            JsonNode acA = jrO.get("activity-clusters");
+            for (int i = 0; i < acA.size(); ++i) {
+                JsonNode acO = acA.get(i);
                 if (acO.has("plan")) {
-                    JSONObject planO = acO.getJSONObject("plan");
+                    JsonNode planO = acO.get("plan");
                     if (planO.has("task-clusters")) {
-                        JSONArray tcA = planO.getJSONArray("task-clusters");
-                        for (int j = 0; j < tcA.length(); ++j) {
-                            JSONObject tcO = tcA.getJSONObject(j);
-                            String tcId = tcO.getString("task-cluster-id");
+                        JsonNode tcA = planO.get("task-clusters");
+                        for (int j = 0; j < tcA.size(); ++j) {
+                            JsonNode tcO = tcA.get(j);
+                            String tcId = tcO.get("task-cluster-id").asText();
                             if (tcO.has("attempts")) {
-                                JSONArray tcaA = tcO.getJSONArray("attempts");
-                                TaskClusterAttempt[] tcAttempts = new TaskClusterAttempt[tcaA.length()];
-                                for (int k = 0; k < tcaA.length(); ++k) {
-                                    JSONObject tcaO = tcaA.getJSONObject(k);
-                                    int attempt = tcaO.getInt("attempt");
-                                    long startTime = tcaO.getLong("start-time");
-                                    long endTime = tcaO.getLong("end-time");
+                                JsonNode tcaA = tcO.get("attempts");
+                                TaskClusterAttempt[] tcAttempts = new TaskClusterAttempt[tcaA.size()];
+                                for (int k = 0; k < tcaA.size(); ++k) {
+                                    JsonNode tcaO = tcaA.get(k);
+                                    int attempt = tcaO.get("attempt").asInt();
+                                    long startTime = tcaO.get("start-time").asLong();
+                                    long endTime = tcaO.get("end-time").asLong();
 
                                     tcAttempts[k] = new TaskClusterAttempt(tcId, attempt, startTime, endTime);
                                     if (startTime < minTime) {
@@ -117,13 +118,13 @@
                                         maxTime = endTime;
                                     }
                                     if (tcaO.has("task-attempts")) {
-                                        JSONArray taArray = tcaO.getJSONArray("task-attempts");
-                                        tcAttempts[k].tasks = new TaskAttempt[taArray.length()];
-                                        for (int l = 0; l < taArray.length(); ++l) {
-                                            JSONObject taO = taArray.getJSONObject(l);
-                                            TaskAttemptId taId = TaskAttemptId.parse(taO.getString("task-attempt-id"));
-                                            TaskAttempt ta = new TaskAttempt(taId, taO.getLong("start-time"),
-                                                    taO.getLong("end-time"));
+                                        JsonNode taArray = tcaO.get("task-attempts");
+                                        tcAttempts[k].tasks = new TaskAttempt[taArray.size()];
+                                        for (int l = 0; l < taArray.size(); ++l) {
+                                            JsonNode taO = taArray.get(l);
+                                            TaskAttemptId taId = TaskAttemptId.parse(taO.get("task-attempt-id").asText());
+                                            TaskAttempt ta = new TaskAttempt(taId, taO.get("start-time").asLong(),
+                                                    taO.get("end-time").asLong());
                                             tcAttempts[k].tasks[l] = ta;
                                             TaskId tid = taId.getTaskId();
                                             ta.name = activityMap.get(tid.getActivityId());
@@ -154,31 +155,31 @@
 
         Map<TaskAttemptId, TaskProfile> tpMap = new HashMap<TaskAttemptId, TaskProfile>();
         if (jrO.has("profile")) {
-            JSONObject pO = jrO.getJSONObject("profile");
+            JsonNode pO = jrO.get("profile");
             if (pO.has("joblets")) {
-                JSONArray jobletsA = pO.getJSONArray("joblets");
-                for (int i = 0; i < jobletsA.length(); ++i) {
-                    JSONObject jobletO = jobletsA.getJSONObject(i);
+                JsonNode jobletsA = pO.get("joblets");
+                for (int i = 0; i < jobletsA.size(); ++i) {
+                    JsonNode jobletO = jobletsA.get(i);
                     if (jobletO.has("tasks")) {
-                        JSONArray tasksA = jobletO.getJSONArray("tasks");
-                        for (int j = 0; j < tasksA.length(); ++j) {
-                            JSONObject taskO = tasksA.getJSONObject(j);
-                            ActivityId activityId = ActivityId.parse(taskO.getString("activity-id"));
-                            int partition = taskO.getInt("partition");
-                            int attempt = taskO.getInt("attempt");
+                        JsonNode tasksA = jobletO.get("tasks");
+                        for (int j = 0; j < tasksA.size(); ++j) {
+                            JsonNode taskO = tasksA.get(j);
+                            ActivityId activityId = ActivityId.parse(taskO.get("activity-id").asText());
+                            int partition = taskO.get("partition").asInt();
+                            int attempt = taskO.get("attempt").asInt();
                             TaskAttemptId taId = new TaskAttemptId(new TaskId(activityId, partition), attempt);
                             if (taskO.has("partition-send-profile")) {
-                                JSONArray taskProfilesA = taskO.getJSONArray("partition-send-profile");
-                                for (int k = 0; k < taskProfilesA.length(); ++k) {
-                                    JSONObject ppO = taskProfilesA.getJSONObject(k);
-                                    long openTime = ppO.getLong("open-time");
-                                    long closeTime = ppO.getLong("close-time");
-                                    int resolution = ppO.getInt("resolution");
-                                    long offset = ppO.getLong("offset");
-                                    JSONArray frameTimesA = ppO.getJSONArray("frame-times");
-                                    long[] frameTimes = new long[frameTimesA.length()];
+                                JsonNode taskProfilesA = taskO.get("partition-send-profile");
+                                for (int k = 0; k < taskProfilesA.size(); ++k) {
+                                    JsonNode ppO = taskProfilesA.get(k);
+                                    long openTime = ppO.get("open-time").asLong();
+                                    long closeTime = ppO.get("close-time").asLong();
+                                    int resolution = ppO.get("resolution").asInt();
+                                    long offset = ppO.get("offset").asLong();
+                                    JsonNode frameTimesA = ppO.get("frame-times");
+                                    long[] frameTimes = new long[frameTimesA.size()];
                                     for (int l = 0; l < frameTimes.length; ++l) {
-                                        frameTimes[l] = frameTimesA.getInt(l) + offset;
+                                        frameTimes[l] = frameTimesA.get(l).asLong() + offset;
                                     }
                                     TaskProfile tp = new TaskProfile(taId, openTime, closeTime, frameTimes, resolution);
                                     if (!tpMap.containsKey(tp.taId)) {
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/job/JobRun.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/job/JobRun.java
index dbe4202..f1d04bb 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/job/JobRun.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/job/JobRun.java
@@ -28,10 +28,9 @@
 import java.util.Map;
 import java.util.Set;
 
-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.OperatorDescriptorId;
@@ -237,131 +236,132 @@
         return connectorPolicyMap;
     }
 
-    public JSONObject toJSON() throws JSONException {
-        JSONObject result = new JSONObject();
+    public ObjectNode toJSON()  {
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode result = om.createObjectNode();
 
         result.put("job-id", jobId.toString());
-        result.put("status", getStatus());
+        result.putPOJO("status", getStatus());
         result.put("create-time", getCreateTime());
         result.put("start-time", getStartTime());
         result.put("end-time", getEndTime());
 
-        JSONArray aClusters = new JSONArray();
+        ArrayNode aClusters = om.createArrayNode();
         for (ActivityCluster ac : acg.getActivityClusterMap().values()) {
-            JSONObject acJSON = new JSONObject();
+            ObjectNode acJSON = om.createObjectNode();
 
             acJSON.put("activity-cluster-id", String.valueOf(ac.getId()));
 
-            JSONArray activitiesJSON = new JSONArray();
+            ArrayNode activitiesJSON = om.createArrayNode();
             for (ActivityId aid : ac.getActivityMap().keySet()) {
-                activitiesJSON.put(aid);
+                activitiesJSON.addPOJO(aid);
             }
-            acJSON.put("activities", activitiesJSON);
+            acJSON.set("activities", activitiesJSON);
 
-            JSONArray dependenciesJSON = new JSONArray();
+            ArrayNode dependenciesJSON = om.createArrayNode();
             for (ActivityCluster dependency : ac.getDependencies()) {
-                dependenciesJSON.put(String.valueOf(dependency.getId()));
+                dependenciesJSON.add(String.valueOf(dependency.getId()));
             }
-            acJSON.put("dependencies", dependenciesJSON);
+            acJSON.set("dependencies", dependenciesJSON);
 
             ActivityClusterPlan acp = activityClusterPlanMap.get(ac.getId());
             if (acp == null) {
-                acJSON.put("plan", (Object) null);
+                acJSON.putNull("plan");
             } else {
-                JSONObject planJSON = new JSONObject();
+                ObjectNode planJSON = om.createObjectNode();
 
-                JSONArray acTasks = new JSONArray();
+                ArrayNode acTasks = om.createArrayNode();
                 for (Map.Entry<ActivityId, ActivityPlan> e : acp.getActivityPlanMap().entrySet()) {
                     ActivityPlan acPlan = e.getValue();
-                    JSONObject entry = new JSONObject();
+                    ObjectNode entry = om.createObjectNode();
                     entry.put("activity-id", e.getKey().toString());
 
                     ActivityPartitionDetails apd = acPlan.getActivityPartitionDetails();
                     entry.put("partition-count", apd.getPartitionCount());
 
-                    JSONArray inPartCountsJSON = new JSONArray();
+                    ArrayNode inPartCountsJSON = om.createArrayNode();
                     int[] inPartCounts = apd.getInputPartitionCounts();
                     if (inPartCounts != null) {
                         for (int i : inPartCounts) {
-                            inPartCountsJSON.put(i);
+                            inPartCountsJSON.add(i);
                         }
                     }
-                    entry.put("input-partition-counts", inPartCountsJSON);
+                    entry.set("input-partition-counts", inPartCountsJSON);
 
-                    JSONArray outPartCountsJSON = new JSONArray();
+                    ArrayNode outPartCountsJSON = om.createArrayNode();
                     int[] outPartCounts = apd.getOutputPartitionCounts();
                     if (outPartCounts != null) {
                         for (int o : outPartCounts) {
-                            outPartCountsJSON.put(o);
+                            outPartCountsJSON.add(o);
                         }
                     }
-                    entry.put("output-partition-counts", outPartCountsJSON);
+                    entry.set("output-partition-counts", outPartCountsJSON);
 
-                    JSONArray tasks = new JSONArray();
+                    ArrayNode tasks = om.createArrayNode();
                     for (Task t : acPlan.getTasks()) {
-                        JSONObject task = new JSONObject();
+                        ObjectNode task = om.createObjectNode();
 
                         task.put("task-id", t.getTaskId().toString());
 
-                        JSONArray dependentTasksJSON = new JSONArray();
+                        ArrayNode dependentTasksJSON = om.createArrayNode();
                         for (TaskId dependent : t.getDependents()) {
-                            dependentTasksJSON.put(dependent.toString());
-                        }
-                        task.put("dependents", dependentTasksJSON);
+                            dependentTasksJSON.add(dependent.toString());
+                        task.set("dependents", dependentTasksJSON);
 
-                        JSONArray dependencyTasksJSON = new JSONArray();
+                        ArrayNode dependencyTasksJSON = om.createArrayNode();
                         for (TaskId dependency : t.getDependencies()) {
-                            dependencyTasksJSON.put(dependency.toString());
+                            dependencyTasksJSON.add(dependency.toString());
                         }
-                        task.put("dependencies", dependencyTasksJSON);
+                        task.set("dependencies", dependencyTasksJSON);
 
-                        tasks.put(task);
+                        tasks.add(task);
                     }
-                    entry.put("tasks", tasks);
+                    entry.set("tasks", tasks);
 
-                    acTasks.put(entry);
+                    acTasks.add(entry);
+                    }
                 }
-                planJSON.put("activities", acTasks);
+                planJSON.set("activities", acTasks);
 
-                JSONArray tClusters = new JSONArray();
+                ArrayNode tClusters = om.createArrayNode();
                 for (TaskCluster tc : acp.getTaskClusters()) {
-                    JSONObject c = new JSONObject();
+                    ObjectNode c = om.createObjectNode();
                     c.put("task-cluster-id", String.valueOf(tc.getTaskClusterId()));
 
-                    JSONArray tasks = new JSONArray();
+                    ArrayNode tasksAry = om.createArrayNode();
                     for (Task t : tc.getTasks()) {
-                        tasks.put(t.getTaskId().toString());
+                        tasksAry.add(t.getTaskId().toString());
                     }
-                    c.put("tasks", tasks);
+                    c.set("tasks", tasksAry);
 
-                    JSONArray prodParts = new JSONArray();
+                    ArrayNode prodParts = om.createArrayNode();
                     for (PartitionId p : tc.getProducedPartitions()) {
-                        prodParts.put(p.toString());
+                        prodParts.add(p.toString());
                     }
-                    c.put("produced-partitions", prodParts);
+                    c.set("produced-partitions", prodParts);
 
-                    JSONArray reqdParts = new JSONArray();
+                    ArrayNode reqdParts = om.createArrayNode();
                     for (PartitionId p : tc.getRequiredPartitions()) {
-                        reqdParts.put(p.toString());
+                        reqdParts.add(p.toString());
                     }
-                    c.put("required-partitions", reqdParts);
+                    c.set("required-partitions", reqdParts);
 
-                    JSONArray attempts = new JSONArray();
+                    ArrayNode attempts = om.createArrayNode();
                     List<TaskClusterAttempt> tcAttempts = tc.getAttempts();
                     if (tcAttempts != null) {
                         for (TaskClusterAttempt tca : tcAttempts) {
-                            JSONObject attempt = new JSONObject();
+                            ObjectNode attempt = om.createObjectNode();
                             attempt.put("attempt", tca.getAttempt());
-                            attempt.put("status", tca.getStatus());
+                            attempt.putPOJO("status", tca.getStatus());
                             attempt.put("start-time", tca.getStartTime());
                             attempt.put("end-time", tca.getEndTime());
 
-                            JSONArray taskAttempts = new JSONArray();
+                            ArrayNode taskAttempts = om.createArrayNode();
                             for (TaskAttempt ta : tca.getTaskAttempts().values()) {
-                                JSONObject taskAttempt = new JSONObject();
-                                taskAttempt.put("task-id", ta.getTaskAttemptId().getTaskId());
-                                taskAttempt.put("task-attempt-id", ta.getTaskAttemptId());
-                                taskAttempt.put("status", ta.getStatus());
+                                ObjectNode taskAttempt = om.createObjectNode();
+                                taskAttempt.putPOJO("task-id", ta.getTaskAttemptId().getTaskId());
+                                taskAttempt.putPOJO("task-attempt-id", ta.getTaskAttemptId());
+                                taskAttempt.putPOJO("status", ta.getStatus());
                                 taskAttempt.put("node-id", ta.getNodeId());
                                 taskAttempt.put("start-time", ta.getStartTime());
                                 taskAttempt.put("end-time", ta.getEndTime());
@@ -374,26 +374,26 @@
                                         taskAttempt.put("failure-details", exceptionWriter.toString());
                                     }
                                 }
-                                taskAttempts.put(taskAttempt);
+                                taskAttempts.add(taskAttempt);
                             }
-                            attempt.put("task-attempts", taskAttempts);
+                            attempt.set("task-attempts", taskAttempts);
 
-                            attempts.put(attempt);
+                            attempts.add(attempt);
                         }
                     }
-                    c.put("attempts", attempts);
+                    c.set("attempts", attempts);
 
-                    tClusters.put(c);
+                    tClusters.add(c);
                 }
-                planJSON.put("task-clusters", tClusters);
+                planJSON.set("task-clusters", tClusters);
 
-                acJSON.put("plan", planJSON);
+                acJSON.set("plan", planJSON);
             }
-            aClusters.put(acJSON);
+            aClusters.add(acJSON);
         }
-        result.put("activity-clusters", aClusters);
+        result.set("activity-clusters", aClusters);
 
-        result.put("profile", profile.toJSON());
+        result.set("profile", profile.toJSON());
 
         return result;
     }
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/scheduler/JobScheduler.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/scheduler/JobScheduler.java
index ab026eb..b577ff7 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/scheduler/JobScheduler.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/scheduler/JobScheduler.java
@@ -31,9 +31,8 @@
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
-import org.json.JSONException;
-import org.json.JSONObject;
-
+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.constraints.Constraint;
 import org.apache.hyracks.api.constraints.expressions.LValueConstraintExpression;
@@ -80,6 +79,7 @@
 
     private final Set<TaskCluster> inProgressTaskClusters;
 
+
     public JobScheduler(ClusterControllerService ccs, JobRun jobRun, Collection<Constraint> constraints) {
         this.ccs = ccs;
         this.jobRun = jobRun;
@@ -734,15 +734,12 @@
         }
     }
 
-    private JSONObject createJobLogObject(final JobRun run) {
-        JSONObject jobLogObject = new JSONObject();
-        try {
-            ActivityClusterGraph acg = run.getActivityClusterGraph();
-            jobLogObject.put("activity-cluster-graph", acg.toJSON());
-            jobLogObject.put("job-run", run.toJSON());
-        } catch (JSONException e) {
-            throw new RuntimeException(e);
-        }
+    private ObjectNode createJobLogObject(final JobRun run) {
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode jobLogObject = om.createObjectNode();
+        ActivityClusterGraph acg = run.getActivityClusterGraph();
+        jobLogObject.set("activity-cluster-graph", acg.toJSON());
+        jobLogObject.set("job-run", run.toJSON());
         return jobLogObject;
     }
 }
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/web/JobsRESTAPIFunction.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/web/JobsRESTAPIFunction.java
index bab77ca..e69884a 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/web/JobsRESTAPIFunction.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/web/JobsRESTAPIFunction.java
@@ -18,7 +18,8 @@
  */
 package org.apache.hyracks.control.cc.web;
 
-import org.json.JSONObject;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 
 import org.apache.hyracks.api.job.JobId;
 import org.apache.hyracks.control.cc.ClusterControllerService;
@@ -35,8 +36,9 @@
     }
 
     @Override
-    public JSONObject invoke(String[] arguments) throws Exception {
-        JSONObject result = new JSONObject();
+    public ObjectNode invoke(String[] arguments) throws Exception {
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode result = om.createObjectNode();
         switch (arguments.length) {
             case 1:
                 if (!"".equals(arguments[0])) {
@@ -45,7 +47,7 @@
             case 0: {
                 GetJobSummariesJSONWork gjse = new GetJobSummariesJSONWork(ccs);
                 ccs.getWorkQueue().scheduleAndSync(gjse);
-                result.put("result", gjse.getSummaries());
+                result.set("result", gjse.getSummaries());
                 break;
             }
 
@@ -55,11 +57,11 @@
                 if ("job-activity-graph".equalsIgnoreCase(arguments[1])) {
                     GetActivityClusterGraphJSONWork gjage = new GetActivityClusterGraphJSONWork(ccs, jobId);
                     ccs.getWorkQueue().scheduleAndSync(gjage);
-                    result.put("result", gjage.getJSON());
+                    result.set("result", gjage.getJSON());
                 } else if ("job-run".equalsIgnoreCase(arguments[1])) {
                     GetJobRunJSONWork gjre = new GetJobRunJSONWork(ccs, jobId);
                     ccs.getWorkQueue().scheduleAndSync(gjre);
-                    result.put("result", gjre.getJSON());
+                    result.set("result", gjre.getJSON());
                 }
 
                 break;
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/web/NodesRESTAPIFunction.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/web/NodesRESTAPIFunction.java
index 58deb55..8994895 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/web/NodesRESTAPIFunction.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/web/NodesRESTAPIFunction.java
@@ -18,7 +18,8 @@
  */
 package org.apache.hyracks.control.cc.web;
 
-import org.json.JSONObject;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 
 import org.apache.hyracks.control.cc.ClusterControllerService;
 import org.apache.hyracks.control.cc.web.util.IJSONOutputFunction;
@@ -33,19 +34,20 @@
     }
 
     @Override
-    public JSONObject invoke(String[] arguments) throws Exception {
-        JSONObject result = new JSONObject();
+    public ObjectNode invoke(String[] arguments) throws Exception {
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode result = om.createObjectNode();
         switch (arguments.length) {
             case 1: {
                 if ("".equals(arguments[0])) {
                     GetNodeSummariesJSONWork gnse = new GetNodeSummariesJSONWork(ccs);
                     ccs.getWorkQueue().scheduleAndSync(gnse);
-                    result.put("result", gnse.getSummaries());
+                    result.set("result", gnse.getSummaries());
                 } else {
                     String nodeId = arguments[0];
                     GetNodeDetailsJSONWork gnde = new GetNodeDetailsJSONWork(ccs, nodeId, true, true);
                     ccs.getWorkQueue().scheduleAndSync(gnde);
-                    result.put("result", gnde.getDetail());
+                    result.set("result", gnde.getDetail());
                 }
             }
         }
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/web/StateDumpRESTAPIFunction.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/web/StateDumpRESTAPIFunction.java
index 000cf46..0657f59 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/web/StateDumpRESTAPIFunction.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/web/StateDumpRESTAPIFunction.java
@@ -20,7 +20,8 @@
 
 import java.util.Map;
 
-import org.json.JSONObject;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 
 import org.apache.hyracks.control.cc.ClusterControllerService;
 import org.apache.hyracks.control.cc.web.util.IJSONOutputFunction;
@@ -35,13 +36,14 @@
     }
 
     @Override
-    public JSONObject invoke(String[] arguments) throws Exception {
+    public ObjectNode invoke(String[] arguments) throws Exception {
         GatherStateDumpsWork gsdw = new GatherStateDumpsWork(ccs);
         ccs.getWorkQueue().scheduleAndSync(gsdw);
         StateDumpRun sdr = gsdw.getStateDumpRun();
         sdr.waitForCompletion();
 
-        JSONObject result = new JSONObject();
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode result = om.createObjectNode();
         for (Map.Entry<String, String> e : sdr.getStateDump().entrySet()) {
             result.put(e.getKey(), e.getValue());
         }
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/web/util/IJSONOutputFunction.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/web/util/IJSONOutputFunction.java
index f55bf84..ab0a581 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/web/util/IJSONOutputFunction.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/web/util/IJSONOutputFunction.java
@@ -18,8 +18,8 @@
  */
 package org.apache.hyracks.control.cc.web.util;
 
-import org.json.JSONObject;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 
 public interface IJSONOutputFunction {
-    public JSONObject invoke(String[] arguments) throws Exception;
+    public ObjectNode invoke(String[] arguments) throws Exception;
 }
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/web/util/JSONOutputRequestHandler.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/web/util/JSONOutputRequestHandler.java
index b00eeae..e736406 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/web/util/JSONOutputRequestHandler.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/web/util/JSONOutputRequestHandler.java
@@ -24,9 +24,10 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 import org.eclipse.jetty.server.Request;
 import org.eclipse.jetty.server.handler.AbstractHandler;
-import org.json.JSONObject;
 
 public class JSONOutputRequestHandler extends AbstractHandler {
     private final IJSONOutputFunction fn;
@@ -46,9 +47,10 @@
         }
         String[] parts = target.split("/");
         try {
-            JSONObject result = fn.invoke(parts);
+            ObjectNode result = fn.invoke(parts);
             response.setContentType("application/json");
-            result.write(response.getWriter());
+            ObjectMapper om = new ObjectMapper();
+            om.writer().writeValue(response.getWriter(),result);
             baseRequest.setHandled(true);
         } catch (Exception e) {
             e.printStackTrace();
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/web/util/JSONUtils.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/web/util/JSONUtils.java
deleted file mode 100644
index 5da4d9d..0000000
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/web/util/JSONUtils.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.hyracks.control.cc.web.util;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-
-public class JSONUtils {
-    public static List<JSONObject> toList(JSONArray array) throws JSONException {
-        List<JSONObject> list = new ArrayList<JSONObject>();
-        for (int i = 0; i < array.length(); ++i) {
-            list.add((JSONObject) array.get(i));
-        }
-        return list;
-    }
-}
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/GetActivityClusterGraphJSONWork.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/GetActivityClusterGraphJSONWork.java
index 951e67e..294ae97 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/GetActivityClusterGraphJSONWork.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/GetActivityClusterGraphJSONWork.java
@@ -18,7 +18,8 @@
  */
 package org.apache.hyracks.control.cc.work;
 
-import org.json.JSONObject;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 
 import org.apache.hyracks.api.job.JobId;
 import org.apache.hyracks.control.cc.ClusterControllerService;
@@ -28,7 +29,7 @@
 public class GetActivityClusterGraphJSONWork extends SynchronizableWork {
     private final ClusterControllerService ccs;
     private final JobId jobId;
-    private JSONObject json;
+    private ObjectNode json;
 
     public GetActivityClusterGraphJSONWork(ClusterControllerService ccs, JobId jobId) {
         this.ccs = ccs;
@@ -37,18 +38,20 @@
 
     @Override
     protected void doRun() throws Exception {
+
+        ObjectMapper om = new ObjectMapper();
         JobRun run = ccs.getActiveRunMap().get(jobId);
         if (run == null) {
             run = ccs.getRunMapArchive().get(jobId);
             if (run == null) {
-                json = new JSONObject();
+                json = om.createObjectNode();
                 return;
             }
         }
         json = run.getActivityClusterGraph().toJSON();
     }
 
-    public JSONObject getJSON() {
+    public ObjectNode getJSON() {
         return json;
     }
 }
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/GetJobRunJSONWork.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/GetJobRunJSONWork.java
index f2119c3..aad6edf 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/GetJobRunJSONWork.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/GetJobRunJSONWork.java
@@ -18,7 +18,8 @@
  */
 package org.apache.hyracks.control.cc.work;
 
-import org.json.JSONObject;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 
 import org.apache.hyracks.api.job.JobId;
 import org.apache.hyracks.control.cc.ClusterControllerService;
@@ -28,7 +29,7 @@
 public class GetJobRunJSONWork extends SynchronizableWork {
     private final ClusterControllerService ccs;
     private final JobId jobId;
-    private JSONObject json;
+    private ObjectNode json;
 
     public GetJobRunJSONWork(ClusterControllerService ccs, JobId jobId) {
         this.ccs = ccs;
@@ -37,18 +38,19 @@
 
     @Override
     protected void doRun() throws Exception {
+        ObjectMapper om = new ObjectMapper();
         JobRun run = ccs.getActiveRunMap().get(jobId);
         if (run == null) {
             run = ccs.getRunMapArchive().get(jobId);
             if (run == null) {
-                json = new JSONObject();
+                json = om.createObjectNode();
                 return;
             }
         }
         json = run.toJSON();
     }
 
-    public JSONObject getJSON() {
+    public ObjectNode getJSON() {
         return json;
     }
 }
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/GetJobSummariesJSONWork.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/GetJobSummariesJSONWork.java
index bc4468a..1e5a3a5 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/GetJobSummariesJSONWork.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/GetJobSummariesJSONWork.java
@@ -20,17 +20,16 @@
 
 import java.util.Collection;
 
-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.control.cc.ClusterControllerService;
 import org.apache.hyracks.control.cc.job.JobRun;
 import org.apache.hyracks.control.common.work.SynchronizableWork;
 
 public class GetJobSummariesJSONWork extends SynchronizableWork {
     private final ClusterControllerService ccs;
-    private JSONArray summaries;
+    private ArrayNode summaries;
 
     public GetJobSummariesJSONWork(ClusterControllerService ccs) {
         this.ccs = ccs;
@@ -38,25 +37,27 @@
 
     @Override
     protected void doRun() throws Exception {
-        summaries = new JSONArray();
+        ObjectMapper om = new ObjectMapper();
+        summaries = om.createArrayNode();
         populateJSON(ccs.getActiveRunMap().values());
         populateJSON(ccs.getRunMapArchive().values());
     }
 
-    private void populateJSON(Collection<JobRun> jobRuns) throws JSONException {
+    private void populateJSON(Collection<JobRun> jobRuns)  {
+        ObjectMapper om = new ObjectMapper();
         for (JobRun run : jobRuns) {
-            JSONObject jo = new JSONObject();
+            ObjectNode jo = om.createObjectNode();
             jo.put("type", "job-summary");
             jo.put("job-id", run.getJobId().toString());
             jo.put("create-time", run.getCreateTime());
             jo.put("start-time", run.getStartTime());
             jo.put("end-time", run.getEndTime());
             jo.put("status", run.getStatus().toString());
-            summaries.put(jo);
+            summaries.add(jo);
         }
     }
 
-    public JSONArray getSummaries() {
+    public ArrayNode getSummaries() {
         return summaries;
     }
 }
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/GetNodeDetailsJSONWork.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/GetNodeDetailsJSONWork.java
index dab41ba..4a8dd1f 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/GetNodeDetailsJSONWork.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/GetNodeDetailsJSONWork.java
@@ -35,13 +35,13 @@
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 import org.apache.hyracks.control.cc.ClusterControllerService;
 import org.apache.hyracks.control.cc.NodeControllerState;
 import org.apache.hyracks.control.common.utils.PidHelper;
 import org.apache.hyracks.control.common.work.IPCResponder;
 import org.apache.hyracks.control.common.work.SynchronizableWork;
-import org.json.JSONException;
-import org.json.JSONObject;
 import org.kohsuke.args4j.Option;
 
 public class GetNodeDetailsJSONWork extends SynchronizableWork {
@@ -51,7 +51,8 @@
     private final boolean includeStats;
     private final boolean includeConfig;
     private final IPCResponder<String> callback;
-    private JSONObject detail;
+    private ObjectNode detail;
+    private ObjectMapper om = new ObjectMapper();
 
     public GetNodeDetailsJSONWork(ClusterControllerService ccs, String nodeId, boolean includeStats,
                                   boolean includeConfig, IPCResponder<String> callback) {
@@ -86,12 +87,12 @@
         }
 
         if (callback != null) {
-            callback.setValue(detail == null ? null : detail.toString());
+            callback.setValue(detail == null ? null : om.writeValueAsString(detail));
         }
     }
 
-    private JSONObject getCCDetails() throws JSONException {
-        JSONObject o = new JSONObject();
+    private ObjectNode getCCDetails()  {
+        ObjectNode o = om.createObjectNode();
         MemoryMXBean memoryMXBean = ManagementFactory.getMemoryMXBean();
         List<GarbageCollectorMXBean> gcMXBeans = ManagementFactory.getGarbageCollectorMXBeans();
         ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
@@ -106,29 +107,29 @@
             o.put("vm_name", runtimeMXBean.getVmName());
             o.put("vm_version", runtimeMXBean.getVmVersion());
             o.put("vm_vendor", runtimeMXBean.getVmVendor());
-            o.put("classpath", runtimeMXBean.getClassPath().split(File.pathSeparator));
-            o.put("library_path", runtimeMXBean.getLibraryPath().split(File.pathSeparator));
-            o.put("boot_classpath", runtimeMXBean.getBootClassPath().split(File.pathSeparator));
-            o.put("input_arguments", runtimeMXBean.getInputArguments());
-            o.put("system_properties", runtimeMXBean.getSystemProperties());
+            o.putPOJO("classpath", runtimeMXBean.getClassPath().split(File.pathSeparator));
+            o.putPOJO("library_path", runtimeMXBean.getLibraryPath().split(File.pathSeparator));
+            o.putPOJO("boot_classpath", runtimeMXBean.getBootClassPath().split(File.pathSeparator));
+            o.putPOJO("input_arguments", runtimeMXBean.getInputArguments());
+            o.putPOJO("system_properties", runtimeMXBean.getSystemProperties());
             o.put("pid", PidHelper.getPid());
         }
         if (includeStats) {
             MemoryUsage heapUsage = memoryMXBean.getHeapMemoryUsage();
             MemoryUsage nonheapUsage = memoryMXBean.getNonHeapMemoryUsage();
 
-            List<JSONObject> gcs = new ArrayList<>();
+            List<ObjectNode> gcs = new ArrayList<>();
 
             for (GarbageCollectorMXBean gcMXBean : gcMXBeans) {
-                JSONObject gc = new JSONObject();
+                ObjectNode gc = om.createObjectNode();
                 gc.put("name", gcMXBean.getName());
                 gc.put("collection-time", gcMXBean.getCollectionTime());
                 gc.put("collection-count", gcMXBean.getCollectionCount());
                 gcs.add(gc);
             }
-            o.put("gcs", gcs);
+            o.putPOJO("gcs", gcs);
 
-            o.put("date", new Date());
+            o.put("date", new Date().toString());
             o.put("heap_init_size", heapUsage.getInit());
             o.put("heap_used_size", heapUsage.getUsed());
             o.put("heap_committed_size", heapUsage.getCommitted());
@@ -145,7 +146,7 @@
         return o;
     }
 
-    private static void addIni(JSONObject o, Object configBean) throws JSONException {
+    private static void addIni(ObjectNode o, Object configBean)  {
         Map<String, Object> iniMap = new HashMap<>();
         for (Field f : configBean.getClass().getFields()) {
             Option option = f.getAnnotation(Option.class);
@@ -170,10 +171,10 @@
                 }
             }
         }
-        o.put("ini", iniMap);
+        o.putPOJO("ini", iniMap);
     }
 
-    public JSONObject getDetail() {
+    public ObjectNode getDetail() {
         return detail;
     }
 }
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/GetNodeSummariesJSONWork.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/GetNodeSummariesJSONWork.java
index 4b81ad0..ebafd7d 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/GetNodeSummariesJSONWork.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/GetNodeSummariesJSONWork.java
@@ -18,7 +18,8 @@
  */
 package org.apache.hyracks.control.cc.work;
 
-import org.json.JSONArray;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ArrayNode;
 
 import org.apache.hyracks.control.cc.ClusterControllerService;
 import org.apache.hyracks.control.cc.NodeControllerState;
@@ -26,7 +27,7 @@
 
 public class GetNodeSummariesJSONWork extends SynchronizableWork {
     private final ClusterControllerService ccs;
-    private JSONArray summaries;
+    private ArrayNode summaries;
 
     public GetNodeSummariesJSONWork(ClusterControllerService ccs) {
         this.ccs = ccs;
@@ -34,13 +35,14 @@
 
     @Override
     protected void doRun() throws Exception {
-        summaries = new JSONArray();
+        ObjectMapper om = new ObjectMapper();
+        summaries = om.createArrayNode();
         for (NodeControllerState ncs : ccs.getNodeMap().values()) {
-            summaries.put(ncs.toSummaryJSON());
+            summaries.add(ncs.toSummaryJSON());
         }
     }
 
-    public JSONArray getSummaries() {
+    public ArrayNode getSummaries() {
         return summaries;
     }
 }
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/JobCleanupWork.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/JobCleanupWork.java
index bd85463..2a383b6 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/JobCleanupWork.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/JobCleanupWork.java
@@ -23,9 +23,8 @@
 import java.util.Set;
 import java.util.logging.Logger;
 
-import org.json.JSONException;
-import org.json.JSONObject;
-
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 import org.apache.hyracks.api.exceptions.HyracksException;
 import org.apache.hyracks.api.job.ActivityClusterGraph;
 import org.apache.hyracks.api.job.JobId;
@@ -123,15 +122,12 @@
         }
     }
 
-    private JSONObject createJobLogObject(final JobRun run) {
-        JSONObject jobLogObject = new JSONObject();
-        try {
-            ActivityClusterGraph acg = run.getActivityClusterGraph();
-            jobLogObject.put("activity-cluster-graph", acg.toJSON());
-            jobLogObject.put("job-run", run.toJSON());
-        } catch (JSONException e) {
-            throw new RuntimeException(e);
-        }
+    private ObjectNode createJobLogObject(final JobRun run) {
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode jobLogObject = om.createObjectNode();
+        ActivityClusterGraph acg = run.getActivityClusterGraph();
+        jobLogObject.set("activity-cluster-graph", acg.toJSON());
+        jobLogObject.set("job-run", run.toJSON());
         return jobLogObject;
     }
 
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/pom.xml b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/pom.xml
index 9f7d9dd..1c8ae20 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/pom.xml
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/pom.xml
@@ -58,11 +58,6 @@
       <version>${project.version}</version>
     </dependency>
     <dependency>
-      <groupId>org.json</groupId>
-      <artifactId>json</artifactId>
-      <version>20090211</version>
-    </dependency>
-    <dependency>
       <groupId>org.apache.httpcomponents</groupId>
       <artifactId>httpcore</artifactId>
       <version>4.4.5</version>
@@ -72,5 +67,9 @@
       <artifactId>httpclient</artifactId>
       <version>4.5.2</version>
     </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-databind</artifactId>
+    </dependency>
   </dependencies>
 </project>
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/job/profiling/om/AbstractProfile.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/job/profiling/om/AbstractProfile.java
index 525be8c..d1d33a5 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/job/profiling/om/AbstractProfile.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/job/profiling/om/AbstractProfile.java
@@ -26,9 +26,9 @@
 import java.util.Map;
 import java.util.Map.Entry;
 
-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.io.IWritable;
 
@@ -45,17 +45,18 @@
         return counters;
     }
 
-    public abstract JSONObject toJSON() throws JSONException;
+    public abstract ObjectNode toJSON() ;
 
-    protected void populateCounters(JSONObject jo) throws JSONException {
-        JSONArray countersObj = new JSONArray();
+    protected void populateCounters(ObjectNode jo) {
+        ObjectMapper om = new ObjectMapper();
+        ArrayNode countersObj = om.createArrayNode();
         for (Map.Entry<String, Long> e : counters.entrySet()) {
-            JSONObject jpe = new JSONObject();
+            ObjectNode jpe = om.createObjectNode();
             jpe.put("name", e.getKey());
             jpe.put("value", e.getValue());
-            countersObj.put(jpe);
+            countersObj.add(jpe);
         }
-        jo.put("counters", countersObj);
+        jo.set("counters", countersObj);
     }
 
     protected void merge(AbstractProfile profile) {
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/job/profiling/om/JobProfile.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/job/profiling/om/JobProfile.java
index e8fec1b..79a5538 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/job/profiling/om/JobProfile.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/job/profiling/om/JobProfile.java
@@ -25,10 +25,9 @@
 import java.util.Map;
 import java.util.Map.Entry;
 
-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.job.JobId;
 
 public class JobProfile extends AbstractProfile {
@@ -62,16 +61,17 @@
     }
 
     @Override
-    public JSONObject toJSON() throws JSONException {
-        JSONObject json = new JSONObject();
+    public ObjectNode toJSON()  {
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode json = om.createObjectNode();
 
         json.put("job-id", jobId.toString());
         populateCounters(json);
-        JSONArray jobletsArray = new JSONArray();
+        ArrayNode jobletsArray = om.createArrayNode();
         for (JobletProfile p : jobletProfiles.values()) {
-            jobletsArray.put(p.toJSON());
+            jobletsArray.add(p.toJSON());
         }
-        json.put("joblets", jobletsArray);
+        json.set("joblets", jobletsArray);
 
         return json;
     }
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/job/profiling/om/JobletProfile.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/job/profiling/om/JobletProfile.java
index 33d5a6c..c3792df 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/job/profiling/om/JobletProfile.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/job/profiling/om/JobletProfile.java
@@ -25,10 +25,10 @@
 import java.util.Map;
 import java.util.Map.Entry;
 
-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.TaskAttemptId;
 
 public class JobletProfile extends AbstractProfile {
@@ -62,16 +62,18 @@
     }
 
     @Override
-    public JSONObject toJSON() throws JSONException {
-        JSONObject json = new JSONObject();
+    public ObjectNode toJSON()  {
+
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode json = om.createObjectNode();
 
         json.put("node-id", nodeId.toString());
         populateCounters(json);
-        JSONArray tasks = new JSONArray();
+        ArrayNode tasks = om.createArrayNode();
         for (TaskProfile p : taskProfiles.values()) {
-            tasks.put(p.toJSON());
+            tasks.add(p.toJSON());
         }
-        json.put("tasks", tasks);
+        json.set("tasks", tasks);
 
         return json;
     }
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/job/profiling/om/TaskProfile.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/job/profiling/om/TaskProfile.java
index a77c56f..680d2f9 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/job/profiling/om/TaskProfile.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/job/profiling/om/TaskProfile.java
@@ -25,10 +25,9 @@
 import java.util.Map;
 import java.util.Map.Entry;
 
-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.TaskAttemptId;
 import org.apache.hyracks.api.partitions.PartitionId;
 import org.apache.hyracks.control.common.job.profiling.counters.MultiResolutionEventProfiler;
@@ -64,39 +63,41 @@
     }
 
     @Override
-    public JSONObject toJSON() throws JSONException {
-        JSONObject json = new JSONObject();
+    public ObjectNode toJSON()  {
+
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode json = om.createObjectNode();
 
         json.put("activity-id", taskAttemptId.getTaskId().getActivityId().toString());
         json.put("partition", taskAttemptId.getTaskId().getPartition());
         json.put("attempt", taskAttemptId.getAttempt());
         if (partitionSendProfile != null) {
-            JSONArray pspArray = new JSONArray();
+            ArrayNode pspArray = om.createArrayNode();
             for (PartitionProfile pp : partitionSendProfile.values()) {
-                JSONObject ppObj = new JSONObject();
+                ObjectNode ppObj = om.createObjectNode();
                 PartitionId pid = pp.getPartitionId();
-                JSONObject pidObj = new JSONObject();
-                pidObj.put("job-id", pid.getJobId());
-                pidObj.put("connector-id", pid.getConnectorDescriptorId());
+                ObjectNode pidObj = om.createObjectNode();
+                pidObj.put("job-id", pid.getJobId().toString());
+                pidObj.put("connector-id", pid.getConnectorDescriptorId().toString());
                 pidObj.put("sender-index", pid.getSenderIndex());
                 pidObj.put("receiver-index", pid.getReceiverIndex());
-                ppObj.put("partition-id", pidObj);
+                ppObj.set("partition-id", pidObj);
                 ppObj.put("open-time", pp.getOpenTime());
                 ppObj.put("close-time", pp.getCloseTime());
                 MultiResolutionEventProfiler samples = pp.getSamples();
                 ppObj.put("offset", samples.getOffset());
                 int resolution = samples.getResolution();
                 int sampleCount = samples.getCount();
-                JSONArray ftA = new JSONArray();
+                ArrayNode ftA = om.createArrayNode();
                 int[] ft = samples.getSamples();
                 for (int i = 0; i < sampleCount; ++i) {
-                    ftA.put(ft[i]);
+                    ftA.add(ft[i]);
                 }
-                ppObj.put("frame-times", ftA);
+                ppObj.set("frame-times", ftA);
                 ppObj.put("resolution", resolution);
-                pspArray.put(ppObj);
+                pspArray.add(ppObj);
             }
-            json.put("partition-send-profile", pspArray);
+            json.set("partition-send-profile", pspArray);
         }
         populateCounters(json);
 
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/logs/LogFile.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/logs/LogFile.java
index 8f95c35..c0f88eb 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/logs/LogFile.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/logs/LogFile.java
@@ -18,12 +18,12 @@
  */
 package org.apache.hyracks.control.common.logs;
 
+import com.fasterxml.jackson.databind.node.ObjectNode;
+
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.PrintWriter;
 
-import org.json.JSONObject;
-
 public class LogFile {
     private final File root;
 
@@ -38,12 +38,12 @@
         openTime = System.currentTimeMillis();
     }
 
-    public synchronized void log(JSONObject object) throws Exception {
+    public synchronized void log(ObjectNode object) throws Exception {
         if (out == null) {
             root.mkdirs();
             out = new PrintWriter(new FileOutputStream(new File(root, openTime + ".log"), true));
         }
-        out.println(object.toString(1));
+        out.println(object.asText());
         out.flush();
     }
 
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/utils/ThreadDumpHelper.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/utils/ThreadDumpHelper.java
index eacb9e0..1d6dbcd 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/utils/ThreadDumpHelper.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/utils/ThreadDumpHelper.java
@@ -18,6 +18,13 @@
  */
 package org.apache.hyracks.control.common.utils;
 
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+
+import java.io.IOException;
 import java.lang.management.ThreadInfo;
 import java.lang.management.ThreadMXBean;
 import java.util.ArrayList;
@@ -26,15 +33,12 @@
 import java.util.List;
 import java.util.Map;
 
-import org.json.JSONException;
-import org.json.JSONObject;
-
 public class ThreadDumpHelper {
 
     private ThreadDumpHelper() {
     }
 
-    public static String takeDumpJSON(ThreadMXBean threadMXBean) throws JSONException {
+    public static String takeDumpJSON(ThreadMXBean threadMXBean) throws IOException {
         ThreadInfo[] threadInfos = threadMXBean.dumpAllThreads(true, true);
         List<Map<String, Object>> threads = new ArrayList<>();
 
@@ -69,18 +73,20 @@
             }
             threads.add(threadMap);
         }
-        JSONObject json = new JSONObject();
-        json.put("date", new Date());
-        json.put("threads", threads);
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode json = om.createObjectNode();
+        json.put("date", new Date().toString());
+        json.putPOJO("threads", threads);
 
-        long [] deadlockedThreads = threadMXBean.findDeadlockedThreads();
-        long [] monitorDeadlockedThreads = threadMXBean.findMonitorDeadlockedThreads();
+        long[] deadlockedThreads = threadMXBean.findDeadlockedThreads();
+        long[] monitorDeadlockedThreads = threadMXBean.findMonitorDeadlockedThreads();
         if (deadlockedThreads != null && deadlockedThreads.length > 0) {
-            json.put("deadlocked_thread_ids", deadlockedThreads);
+            json.putPOJO("deadlocked_thread_ids", deadlockedThreads);
         }
         if (monitorDeadlockedThreads != null && monitorDeadlockedThreads.length > 0) {
-            json.put("monitor_deadlocked_thread_ids", monitorDeadlockedThreads);
+            json.putPOJO("monitor_deadlocked_thread_ids", monitorDeadlockedThreads);
         }
-        return json.toString();
+        om.enable(SerializationFeature.INDENT_OUTPUT);
+        return om.writerWithDefaultPrettyPrinter().writeValueAsString(json);
     }
 }
diff --git a/hyracks-fullstack/hyracks/hyracks-dataflow-std/pom.xml b/hyracks-fullstack/hyracks/hyracks-dataflow-std/pom.xml
index e44feb7..0158068 100644
--- a/hyracks-fullstack/hyracks/hyracks-dataflow-std/pom.xml
+++ b/hyracks-fullstack/hyracks/hyracks-dataflow-std/pom.xml
@@ -48,11 +48,6 @@
       <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>
@@ -90,5 +85,9 @@
       <artifactId>junit</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-databind</artifactId>
+    </dependency>
   </dependencies>
 </project>
diff --git a/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/base/AbstractConnectorDescriptor.java b/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/base/AbstractConnectorDescriptor.java
index e780ea0..6b8b38f 100644
--- a/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/base/AbstractConnectorDescriptor.java
+++ b/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/base/AbstractConnectorDescriptor.java
@@ -18,14 +18,15 @@
  */
 package org.apache.hyracks.dataflow.std.base;
 
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+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.ConnectorDescriptorId;
 import org.apache.hyracks.api.dataflow.IConnectorDescriptor;
 import org.apache.hyracks.api.job.ActivityCluster;
 import org.apache.hyracks.api.job.IConnectorDescriptorRegistry;
-import org.json.JSONException;
-import org.json.JSONObject;
 
 public abstract class AbstractConnectorDescriptor implements IConnectorDescriptor {
     private static final long serialVersionUID = 1L;
@@ -54,8 +55,9 @@
     }
 
     @Override
-    public JSONObject toJSON() throws JSONException {
-        JSONObject jconn = new JSONObject();
+    public JsonNode toJSON() {
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode jconn = om.createObjectNode();
 
         jconn.put("id", String.valueOf(getConnectorId()));
         jconn.put("java-class", getClass().getName());
diff --git a/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/base/AbstractOperatorDescriptor.java b/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/base/AbstractOperatorDescriptor.java
index 4f22a17..a18328e 100644
--- a/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/base/AbstractOperatorDescriptor.java
+++ b/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/base/AbstractOperatorDescriptor.java
@@ -18,14 +18,14 @@
  */
 package org.apache.hyracks.dataflow.std.base;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
+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.IOperatorDescriptor;
 import org.apache.hyracks.api.dataflow.OperatorDescriptorId;
 import org.apache.hyracks.api.dataflow.value.RecordDescriptor;
 import org.apache.hyracks.api.job.IOperatorDescriptorRegistry;
-import org.json.JSONException;
-import org.json.JSONObject;
 
 public abstract class AbstractOperatorDescriptor implements IOperatorDescriptor {
     private static final long serialVersionUID = 1L;
@@ -91,8 +91,9 @@
     }
 
     @Override
-    public JSONObject toJSON() throws JSONException {
-        JSONObject jop = new JSONObject();
+    public ObjectNode toJSON()  {
+        ObjectMapper om = new ObjectMapper();
+        ObjectNode jop = om.createObjectNode();
         jop.put("id", String.valueOf(getOperatorId()));
         jop.put("java-class", getClass().getName());
         jop.put("in-arity", getInputArity());
diff --git a/hyracks-fullstack/hyracks/hyracks-examples/hyracks-integration-tests/pom.xml b/hyracks-fullstack/hyracks/hyracks-examples/hyracks-integration-tests/pom.xml
index 1a5d4ab..d934e8c 100644
--- a/hyracks-fullstack/hyracks/hyracks-examples/hyracks-integration-tests/pom.xml
+++ b/hyracks-fullstack/hyracks/hyracks-examples/hyracks-integration-tests/pom.xml
@@ -137,11 +137,6 @@
       <version>${project.version}</version>
     </dependency>
     <dependency>
-      <groupId>org.json</groupId>
-      <artifactId>json</artifactId>
-      <version>20090211</version>
-    </dependency>
-    <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
       <version>4.12</version>
@@ -152,5 +147,9 @@
       <artifactId>hyracks-storage-common</artifactId>
       <version>${project.version}</version>
     </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-databind</artifactId>
+    </dependency>
   </dependencies>
 </project>
diff --git a/hyracks-fullstack/hyracks/hyracks-examples/hyracks-integration-tests/src/test/java/org/apache/hyracks/tests/integration/AbstractIntegrationTest.java b/hyracks-fullstack/hyracks/hyracks-examples/hyracks-integration-tests/src/test/java/org/apache/hyracks/tests/integration/AbstractIntegrationTest.java
index fe9c1ea..b51a578 100644
--- a/hyracks-fullstack/hyracks/hyracks-examples/hyracks-integration-tests/src/test/java/org/apache/hyracks/tests/integration/AbstractIntegrationTest.java
+++ b/hyracks-fullstack/hyracks/hyracks-examples/hyracks-integration-tests/src/test/java/org/apache/hyracks/tests/integration/AbstractIntegrationTest.java
@@ -137,7 +137,7 @@
 
     protected JobId executeTest(JobSpecification spec) throws Exception {
         if (LOGGER.isLoggable(Level.INFO)) {
-            LOGGER.info(spec.toJSON().toString(2));
+            LOGGER.info(spec.toJSON().asText());
         }
         JobId jobId = hcc.startJob(spec, EnumSet.of(JobFlag.PROFILE_RUNTIME));
         if (LOGGER.isLoggable(Level.INFO)) {
diff --git a/hyracks-fullstack/hyracks/hyracks-examples/hyracks-integration-tests/src/test/java/org/apache/hyracks/tests/integration/AbstractMultiNCIntegrationTest.java b/hyracks-fullstack/hyracks/hyracks-examples/hyracks-integration-tests/src/test/java/org/apache/hyracks/tests/integration/AbstractMultiNCIntegrationTest.java
index 890ab0a..4163e46 100644
--- a/hyracks-fullstack/hyracks/hyracks-examples/hyracks-integration-tests/src/test/java/org/apache/hyracks/tests/integration/AbstractMultiNCIntegrationTest.java
+++ b/hyracks-fullstack/hyracks/hyracks-examples/hyracks-integration-tests/src/test/java/org/apache/hyracks/tests/integration/AbstractMultiNCIntegrationTest.java
@@ -26,6 +26,7 @@
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
 import org.apache.commons.io.FileUtils;
 import org.apache.hyracks.api.client.HyracksConnection;
 import org.apache.hyracks.api.client.IHyracksClientConnection;
@@ -45,7 +46,7 @@
 import org.apache.hyracks.control.nc.resources.memory.FrameManager;
 import org.apache.hyracks.dataflow.common.comm.io.ResultFrameTupleAccessor;
 import org.apache.hyracks.dataflow.common.comm.util.ByteBufferInputStream;
-import org.json.JSONArray;
+import com.fasterxml.jackson.databind.node.ArrayNode;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Rule;
@@ -123,7 +124,7 @@
 
     protected void runTest(JobSpecification spec) throws Exception {
         if (LOGGER.isLoggable(Level.INFO)) {
-            LOGGER.info(spec.toJSON().toString(2));
+            LOGGER.info(spec.toJSON().asText());
         }
         JobId jobId = hcc.startJob(spec, EnumSet.of(JobFlag.PROFILE_RUNTIME));
         if (LOGGER.isLoggable(Level.INFO)) {
@@ -141,7 +142,8 @@
             IHyracksDataset hyracksDataset = new HyracksDataset(hcc, spec.getFrameSize(), nReaders);
             IHyracksDatasetReader reader = hyracksDataset.createReader(jobId, spec.getResultSetIds().get(0));
 
-            JSONArray resultRecords = new JSONArray();
+            ObjectMapper om = new ObjectMapper();
+            ArrayNode resultRecords = om.createArrayNode();
             ByteBufferInputStream bbis = new ByteBufferInputStream();
 
             int readSize = reader.read(resultFrame);
@@ -156,7 +158,7 @@
                         bbis.setByteBuffer(resultFrame.getBuffer(), start);
                         byte[] recordBytes = new byte[length];
                         bbis.read(recordBytes, 0, length);
-                        resultRecords.put(new String(recordBytes, 0, length));
+                        resultRecords.add(new String(recordBytes, 0, length));
                     }
                 } finally {
                     try {
diff --git a/hyracks-fullstack/hyracks/hyracks-server/pom.xml b/hyracks-fullstack/hyracks/hyracks-server/pom.xml
index 70e47fe..3667951 100644
--- a/hyracks-fullstack/hyracks/hyracks-server/pom.xml
+++ b/hyracks-fullstack/hyracks/hyracks-server/pom.xml
@@ -164,11 +164,6 @@
       <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>org.json</groupId>
-      <artifactId>json</artifactId>
-      <version>20090211</version>
-    </dependency>
-    <dependency>
       <groupId>org.apache.httpcomponents</groupId>
       <artifactId>httpcore</artifactId>
       <version>4.4.5</version>
@@ -183,5 +178,9 @@
       <artifactId>hyracks-control-nc</artifactId>
       <version>${project.version}</version>
     </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-databind</artifactId>
+    </dependency>
   </dependencies>
 </project>
diff --git a/hyracks-fullstack/hyracks/hyracks-server/src/test/java/org/apache/hyracks/server/test/NCServiceIT.java b/hyracks-fullstack/hyracks/hyracks-server/src/test/java/org/apache/hyracks/server/test/NCServiceIT.java
index 8d1246b..2185826 100644
--- a/hyracks-fullstack/hyracks/hyracks-server/src/test/java/org/apache/hyracks/server/test/NCServiceIT.java
+++ b/hyracks-fullstack/hyracks/hyracks-server/src/test/java/org/apache/hyracks/server/test/NCServiceIT.java
@@ -23,6 +23,8 @@
 import java.net.InetAddress;
 import java.util.logging.Logger;
 
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
 import junit.framework.Assert;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.http.HttpResponse;
@@ -32,8 +34,8 @@
 import org.apache.http.impl.client.HttpClients;
 import org.apache.http.util.EntityUtils;
 import org.apache.hyracks.server.process.HyracksVirtualCluster;
-import org.json.JSONArray;
-import org.json.JSONObject;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -111,15 +113,17 @@
     @Test
     public void IsNodelistCorrect() throws Exception {
         // Ping the nodelist HTTP API
+
+        ObjectMapper om = new ObjectMapper();
         String localhost = InetAddress.getLoopbackAddress().getHostAddress();
         String response = getHttp("http://" + localhost + ":12345/rest/nodes");
-        JSONObject result = new JSONObject(response);
-        JSONArray nodes = result.getJSONArray("result");
-        int numNodes = nodes.length();
+        JsonNode result = om.readTree(response);
+        JsonNode nodes = result.get("result");
+        int numNodes = nodes.size();
         Assert.assertEquals("Wrong number of nodes!", 2, numNodes);
-        for (int i = 0; i < nodes.length(); i++) {
-            JSONObject node = nodes.getJSONObject(i);
-            String id = node.getString("node-id");
+        for (int i = 0; i < nodes.size(); i++) {
+            JsonNode node = nodes.get(i);
+            String id = node.get("node-id").asText();
             if (id.equals("red") || id.equals("blue")) {
                 continue;
             }
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-common/pom.xml b/hyracks-fullstack/hyracks/hyracks-storage-common/pom.xml
index 5aebb22..724df9e 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-common/pom.xml
+++ b/hyracks-fullstack/hyracks/hyracks-storage-common/pom.xml
@@ -46,10 +46,5 @@
       <artifactId>hyracks-api</artifactId>
       <version>${project.version}</version>
     </dependency>
-    <dependency>
-      <groupId>org.apache.hyracks</groupId>
-      <artifactId>hyracks-api</artifactId>
-      <version>${project.version}</version>
-    </dependency>
   </dependencies>
 </project>
diff --git a/hyracks-fullstack/pom.xml b/hyracks-fullstack/pom.xml
index 9cd9841..7390905 100644
--- a/hyracks-fullstack/pom.xml
+++ b/hyracks-fullstack/pom.xml
@@ -108,6 +108,16 @@
         <artifactId>commons-io</artifactId>
         <version>${commons.io.version}</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>