private void printJson(Path file, TypeTree<? extends Type> typeTree) {
        Gson gson = new GsonBuilder().setPrettyPrinting().create();

        JsonObject jsonTypeTree = new JsonObject();
        jsonTypeTree.addProperty("file", file.toString());

        if (typeTree.embedded()) {
            JsonArray jsonTypes = new JsonArray();

            typeTree.typeMap().forEach((path, typeRoot) -> {
                JsonObject jsonTypeNode = new JsonObject();
                jsonTypeNode.addProperty("pathID", path);
                jsonTypeNode.addProperty("classID", typeRoot.classID());
                if (typeRoot.scriptID() != null) {
                    jsonTypeNode.addProperty("scriptID", typeRoot.scriptID().toString());
                }
                if (typeRoot.oldTypeHash() != null) {
                    jsonTypeNode.addProperty("oldTypeHash", typeRoot.oldTypeHash().toString());
                }

                jsonTypeNode.add("nodes", typeNodeToJson(typeRoot.nodes(), gson));

                jsonTypes.add(jsonTypeNode);
            });

            jsonTypeTree.add("types", jsonTypes);
        }

        gson.toJson(jsonTypeTree, output());
    }
@author Nico Bergemann <barracuda415 at yahoo.de>
disunity-cli/src/main/java/info/ata4/disunity/cli/command/asset/AssetTypes.java