public String write(final Object o, final ObjectInspector objInspector)
      throws SerDeException {

    final JsonNode rootNode =
        walkObjectGraph(objInspector, o, rootStructFieldNames);

    LOG.debug("Create JSON tree from Object tree: {}", rootNode);

    try {
      final ObjectWriter ow = isEnabled(Feature.PRETTY_PRINT)
          ? this.mapper.writerWithDefaultPrettyPrinter()
          : this.mapper.writer();

      return ow.writeValueAsString(rootNode);
    } catch (JsonProcessingException e) {
      throw new SerDeException(e);
    }
  }
Given an Object and an ObjectInspector, convert the structure into a JSON
text string.

@param o The object to convert
@param objInspector The ObjectInspector describing the object
@return A String containing the JSON text
@throws SerDeException The object cannot be transformed
serde/src/java/org/apache/hadoop/hive/serde2/json/HiveJsonWriter.java