@Override
    public Object transform(final TraversalExplanation value) {
        final Map<String, Object> result = new HashMap<>();
        result.put(ORIGINAL, getTraversalSteps(value.getOriginalTraversal()));

        final List<Pair<TraversalStrategy, Traversal.Admin<?, ?>>> strategyTraversals = value.getStrategyTraversals();

        result.put(INTERMEDIATE,
                strategyTraversals.stream().map(pair -> {
                    final Map<String, Object> item = new HashMap<>();
                    item.put(STRATEGY, pair.getValue0().toString());
                    item.put(CATEGORY, pair.getValue0().getTraversalCategory().getSimpleName());
                    item.put(TRAVERSAL, getTraversalSteps(pair.getValue1()));
                    return item;
                }).collect(Collectors.toList()));

        result.put(FINAL, getTraversalSteps(strategyTraversals.isEmpty()
                ? value.getOriginalTraversal() : strategyTraversals.get(strategyTraversals.size() - 1).getValue1()));
        return result;
    }
Creates a Map containing "original", "intermediate" and "final" keys.
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/TraversalExplanationSerializer.java