agave-metadata/metadata-core/src/main/java/org/iplantc/service/metadata/model/MetadataItemCodec.java
/**
     * Write to BsonWriter recursively for nested JsonNodes
     *
     * @param doc    JsonNode to parse
     * @param writer BsonWriter to write to
     * @return BsonWriter
     */
Write to BsonWriter recursively for nested JsonNodes
@param doc    JsonNode to parse
@param writer BsonWriter to write to
@return BsonWriter
Write to BsonWriter recursively for nested JsonNodes @param doc JsonNode to parse @param writer BsonWriter to write to @return BsonWriter
private BsonWriter recursiveParseDocument(JsonNode doc, BsonWriter writer) {
        for (Iterator<String> it = doc.fieldNames(); it.hasNext(); ) {
            String key = it.next();
            if (doc.get(key).isObject()) {
                JsonNode nestedNode = doc.get(key);
                writer.writeStartDocument(key);
                recursiveParseDocument(nestedNode, writer);
            } else {
                writer.writeName(key);
                writer.writeString(String.valueOf(doc.get(key).textValue()));
            }
        }
        writer.writeEndDocument();
        return writer;
    }
private BsonWriter recursiveParseDocument ( JsonNode doc , BsonWriter writer ) { for ( Iterator < String > it = doc . fieldNames ( ) ; it . hasNext ( ) ; ) { String key = it . next ( ) ; if ( doc . get ( key ) . isObject ( ) ) { JsonNode nestedNode = doc . get ( key ) ; writer . writeStartDocument ( key ) ; recursiveParseDocument ( nestedNode , writer ) ; } else { writer . writeName ( key ) ; writer . writeString ( String . valueOf ( doc . get ( key ) . textValue ( ) ) ) ; } } writer . writeEndDocument ( ) ; return writer ; }
Write to BsonWriter recursively for nested JsonNodes
 @param doc    JsonNode to parse
 @param writer BsonWriter to write to
 @return BsonWriter
Write to BsonWriter recursively for nested JsonNodes @param doc JsonNode to parse @param writer BsonWriter to write to @return BsonWriter