private ObjectNode visitMap(final ObjectInspector oi, final Object o)
      throws SerDeException {
    final MapObjectInspector moi = (MapObjectInspector) oi;

    final ObjectInspector mapKeyInspector = moi.getMapKeyObjectInspector();
    final ObjectInspector mapValueInspector = moi.getMapValueObjectInspector();

    final Map<?, ?> map = moi.getMap(o);
    final ObjectNode objectNode = this.nodeFactory.objectNode();

    for (Map.Entry<?, ?> entry : map.entrySet()) {
      final JsonNode keyNode = primitiveToNode(mapKeyInspector, entry.getKey());
      final JsonNode valueNode = walkObjectGraph(mapValueInspector,
          entry.getValue(), Collections.emptyList());
      objectNode.set(keyNode.asText(), valueNode);
    }

    return objectNode;
  }
Visit a vertex in the graph that is a Java Map.

@param oi The map's ObjectInspector
@param o The Map object
@return A JsonNode representation of the Map
@throws SerDeException The Map cannot be parsed
serde/src/java/org/apache/hadoop/hive/serde2/json/HiveJsonWriter.java