public String getJSONValue(Object value) {
    String v = "null";
    if (value != null) {
      v = value.toString();
      if (v.charAt(0) != '[' && v.charAt(0) != '{') {
        v = "\"" + v + "\"";
      }
    }
    return v;
  }
Extract all the counters from tasks and operators.
ql/src/java/org/apache/hadoop/hive/ql/QueryPlan.java