graphdb/src/main/java/com/orientechnologies/orient/graph/graphml/OGraphSONUtility.java
public static ObjectNode objectNodeFromElement(final Element element, final Set<String> propertyKeys, final GraphSONMode mode) {
    final OGraphSONUtility graphson = element instanceof Edge ? new OGraphSONUtility(mode, null, null, propertyKeys)
        : new OGraphSONUtility(mode, null, propertyKeys, null);
    return graphson.objectNodeFromElement(element);
  }
public static ObjectNode objectNodeFromElement(final Element element, final Set<String> propertyKeys, final GraphSONMode mode) {
    final OGraphSONUtility graphson = element instanceof Edge ? new OGraphSONUtility(mode, null, null, propertyKeys)
        : new OGraphSONUtility(mode, null, propertyKeys, null);
    return graphson.objectNodeFromElement(element);
  }
Creates a Jackson ObjectNode from a graph element.

@param element
the graph element to convert to JSON.
@param propertyKeys
The property keys at the root of the element to serialize. If null, then all keys are serialized.
@param mode
The type of GraphSON to generate.